Mesa (master): glcpp: Exhaustively test all legal characters in GLSL

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jan 5 01:26:18 UTC 2017


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

Author: Carl Worth <cworth at cworth.org>
Date:   Tue Aug  5 16:33:04 2014 -0700

glcpp: Exhaustively test all legal characters in GLSL

Here, each legal character (as defined by GLSL Language Specification version
4.30.6, section 3.1) appears at least once in the input file. Obviously,
characters with special meaning (like '#' and '\') aren't treated exhaustively
with respect to all their possible uses. We have many other tests for that.

Here, we're simply ensuring that the test suite sees every legal character at
least once.

v2 (by Ken): Fix expectations, move to src/compiler, renumber tests.

   Carl's .expected:            Updated .expected:

   ..                           ..

   . .                          . .
   . .                          . .
   . .                          . .
   . .                          . .
   .                            ..
   .                            .
   .                            .
   .

(For some reason, the original test expected ".." to produce two lines.
glcpp, cpp, and mcpp all follow my updated behavior, so I believe it to
be correct.)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 .../glsl/glcpp/tests/148-legal-characters.c        | 77 ++++++++++++++++++++++
 .../glcpp/tests/148-legal-characters.c.expected    | 77 ++++++++++++++++++++++
 2 files changed, 154 insertions(+)

diff --git a/src/compiler/glsl/glcpp/tests/148-legal-characters.c b/src/compiler/glsl/glcpp/tests/148-legal-characters.c
new file mode 100644
index 0000000..dc03638
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/148-legal-characters.c
@@ -0,0 +1,77 @@
+/* Legal characters in GLSL are:
+ *
+ * Identifier characters:
+ *
+ *     Letters a-z
+ *     Letters A-Z
+ *     Underscore
+ *     Numbers 0-9
+ *
+ * Punctuation:
+ *
+ *     Period, plus, dash, slash, asterisk, percent, angled brackets,
+ *     square brackets, parentheses, braces, caret, vertical bar,
+ *     ampersand, tilde, equals, exclamation point, colon, semicolon,
+ *     comma, and question mark
+ *
+ * Special:
+ *
+ *     Number sign (as used in preprocessor)
+ *
+ *     Backslash just before newline as line continuation
+ *
+ * White space:
+ *
+ *     Space, horizontal tab, vertical tab, form feed, carriage-return,
+ *     and line-feed.
+ *
+ * [GLSL Language Specficiation 4.30.6, section 3.1]
+ *
+ * In this file, we test each of these in turn as follows:
+ *
+ *    Identifier characters: All pass through unchanged
+ *    Punctuation: All pass through unchanged
+ *    Special: Empty directive replaced with blank line
+ *             Line continuation merges two lines, then a blank line
+ *    Whitespace: 4 horizontal space characters each replaced with space
+ *                2 newline characters each replaced with a newline
+ *
+ */
+abcdefghijklmnopqrstuvwxyz
+ABCDEFGHIJKMLNOPQRSTUVWXYZ
+_
+0123456789
+.
++
+-
+/
+*
+%
+<
+>
+[
+]
+(
+)
+{
+}
+^
+|
+&
+~
+=
+!
+:
+;
+,
+?
+#
+.\
+.
+. .
+.	.
+.
.
+.
.
+..
+.
+.
diff --git a/src/compiler/glsl/glcpp/tests/148-legal-characters.c.expected b/src/compiler/glsl/glcpp/tests/148-legal-characters.c.expected
new file mode 100644
index 0000000..9cb9245
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/148-legal-characters.c.expected
@@ -0,0 +1,77 @@
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+abcdefghijklmnopqrstuvwxyz
+ABCDEFGHIJKMLNOPQRSTUVWXYZ
+_
+0123456789
+.
++
+-
+/
+*
+%
+<
+>
+[
+]
+(
+)
+{
+}
+^
+|
+&
+~
+=
+!
+:
+;
+,
+?
+
+..
+
+. .
+. .
+. .
+. .
+..
+.
+.




More information about the mesa-commit mailing list