Mesa (master): glcpp: Add test involving token pasting of INTEGER tokens.

Carl Worth cworth at kemper.freedesktop.org
Thu Nov 29 21:08:19 UTC 2012


Module: Mesa
Branch: master
Commit: 89cd6df03481dcf0dae948878ad1f77c819b442d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=89cd6df03481dcf0dae948878ad1f77c819b442d

Author: Carl Worth <cworth at cworth.org>
Date:   Wed Nov 28 17:32:03 2012 -0800

glcpp: Add test involving token pasting of INTEGER tokens.

This test file is very similar to test 113-line-and-file-macros but uses token
pasting for cleaner quiz answers (without spaces between the digits). This
test passes thanks to the recent addition of support for pasting INTEGER
tokens, (but would have failed without that).

(Note that this test is distinct from test 059-token-pasting-integer which
pastes integers parsed from the source. Those are parsed to INTEGER_STRING
tokens and are already pasted correctly as verified by that test. The only way
to generate the INTEGER tokens which currently fail to paste is with an
internal define such as __LINE__ that results in an integer.)

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/glcpp/tests/114-paste-integer-tokens.c    |    7 +++++++
 .../tests/114-paste-integer-tokens.c.expected      |    8 ++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/glsl/glcpp/tests/114-paste-integer-tokens.c b/src/glsl/glcpp/tests/114-paste-integer-tokens.c
new file mode 100644
index 0000000..d80d9c7
--- /dev/null
+++ b/src/glsl/glcpp/tests/114-paste-integer-tokens.c
@@ -0,0 +1,7 @@
+#define PASTE3(a,b,c) a ## b ## c
+#define PASTE4(a,b,c,d) a ## b ## c ## d
+#define PASTE5(a,b,c,d,e) a ## b ## c ## d ## e
+4. HTTP code for "Not Found": PASTE3(__LINE__, __FILE__ , __LINE__)
+5. Hexadecimal for 20560: PASTE4(__LINE__, __FILE__, __LINE__, __FILE__)
+6: Zip code for Nortonville, KS: PASTE5(__LINE__, __LINE__, __FILE__, __LINE__,  __FILE__)
+7. James Bond, as a number: PASTE3(__FILE__, __FILE__, __LINE__)
diff --git a/src/glsl/glcpp/tests/114-paste-integer-tokens.c.expected b/src/glsl/glcpp/tests/114-paste-integer-tokens.c.expected
new file mode 100644
index 0000000..a3ad7da
--- /dev/null
+++ b/src/glsl/glcpp/tests/114-paste-integer-tokens.c.expected
@@ -0,0 +1,8 @@
+
+
+
+4. HTTP code for "Not Found": 404
+5. Hexadecimal for 20560: 5050
+6: Zip code for Nortonville, KS: 66060
+7. James Bond, as a number: 007
+




More information about the mesa-commit mailing list