[Mesa-dev] [PATCH 6/7] glcpp: Add test involving token pasting of INTEGER tokens.

Carl Worth cworth at cworth.org
Wed Nov 28 21:38:30 PST 2012


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 happens to fail currently because the token
paster does not support the pasting of INTEGER tokens.

(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.)
---
 src/glsl/glcpp/tests/114-paste-integer-tokens.c          |    7 +++++++
 src/glsl/glcpp/tests/114-paste-integer-tokens.c.expected |    8 ++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 src/glsl/glcpp/tests/114-paste-integer-tokens.c
 create mode 100644 src/glsl/glcpp/tests/114-paste-integer-tokens.c.expected

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
+
-- 
1.7.10



More information about the mesa-dev mailing list