summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2012-11-28 17:32:03 -0800
committerCarl Worth <[email protected]>2012-11-29 13:03:02 -0800
commit89cd6df03481dcf0dae948878ad1f77c819b442d (patch)
tree191ecb2866a8ed80eb01d6ed121123ea87bfcc06 /src/glsl/glcpp
parent522d1ccd77a7eea0421bcb0dcfa88b601146b6d1 (diff)
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 <[email protected]>
Diffstat (limited to 'src/glsl/glcpp')
-rw-r--r--src/glsl/glcpp/tests/114-paste-integer-tokens.c7
-rw-r--r--src/glsl/glcpp/tests/114-paste-integer-tokens.c.expected8
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 00000000000..d80d9c7ef4b
--- /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 00000000000..a3ad7da596d
--- /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
+