Add some CPP tests.
authorJohn Kessenich <cepheus@frii.com>
Wed, 6 Feb 2013 00:14:16 +0000 (00:14 +0000)
committerJohn Kessenich <cepheus@frii.com>
Wed, 6 Feb 2013 00:14:16 +0000 (00:14 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20457 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Test/cppComplexExpr.vert [new file with mode: 0644]
Test/cppIndent.vert [new file with mode: 0644]
Test/cppNest.vert [new file with mode: 0644]
Test/cppSimple.vert [new file with mode: 0644]
Test/testlist

diff --git a/Test/cppComplexExpr.vert b/Test/cppComplexExpr.vert
new file mode 100644 (file)
index 0000000..852eba4
--- /dev/null
@@ -0,0 +1,40 @@
+#define ON1
+#define ON2
+
+float sum = 0.0;
+
+void main()
+{
+#if defined(ON1) && (defined(OFF) || defined(ON2))
+//yes
+    sum += 1.0;
+#endif
+
+#if !defined(ON1) || (defined(OFF) || (!defined(OFF2) && defined(ON2)))
+//yes
+    sum += 20.0;
+#endif
+
+#if defined(ON1) && (defined(OFF) || !defined(ON2))
+//no
+    sum += 0.1;
+#endif
+
+#if !defined(ON1) || (defined(OFF) || !defined(OFF2) && !defined(ON2))
+//no
+    sum += 0.2;
+#endif
+
+#if !defined(ON1) || !defined(OFF) || defined(ON2) && defined(OFF2)
+//yes
+    sum += 300.0;
+#endif
+
+#if (!defined(ON1) || !defined(OFF) || defined(ON2)) && defined(OFF2)
+//no
+    sum += 0.4;
+#endif
+
+// sum should be 321.0
+    gl_Position = vec4(sum);
+}
diff --git a/Test/cppIndent.vert b/Test/cppIndent.vert
new file mode 100644 (file)
index 0000000..a468e77
--- /dev/null
@@ -0,0 +1,55 @@
+#define ON
+
+float sum = 0.0;
+
+void main()
+{
+
+#ifdef ON
+//yes
+sum += 1.0;
+#endif
+
+#ifdef OFF
+    //no
+    sum += 20.0;
+#endif
+
+    #if defined(ON)
+    //yes
+    sum += 300.0;
+    #endif
+
+    #if defined(OFF)
+    //no
+    sum += 4000.0;
+    #endif
+
+                 #if !defined(ON)
+               //no
+               sum += 50000.0;
+               #endif
+
+       #if !defined(OFF)
+               //yes
+               sum += 600000.0;
+               #endif
+
+    #if defined (ON) && defined               (OFF)         
+//no
+sum += 7000000.0;
+    #endif
+
+#if        defined   (  ON         ) && !        defined(OFF)
+//yes
+sum += 80000000.0;
+#endif
+
+#if defined(OFF) || defined(ON)
+//yes
+sum += 900000000.0;
+#endif
+
+// sum should be 980600301.0
+    gl_Position = vec4(sum);
+}
diff --git a/Test/cppNest.vert b/Test/cppNest.vert
new file mode 100644 (file)
index 0000000..1613db2
--- /dev/null
@@ -0,0 +1,75 @@
+#define ON
+
+float sum = 0.0;
+
+void main()
+{
+
+#ifdef ON
+//yes
+sum += 1.0;
+
+    #ifdef OFF
+    //no
+    sum += 20.0;
+    #endif
+
+    #if defined(ON)
+    //yes
+    sum += 300.0;
+    #endif
+
+#endif
+
+
+#if defined(OFF)
+//no
+sum += 4000.0;
+
+#if !defined(ON)
+//no
+sum += 50000.0;
+#endif
+
+    //no
+    sum += 0.1;
+    #ifdef ON
+        //no
+        sum += 0.2;
+    #endif
+
+//no
+    sum + 0.3;
+
+#endif
+
+
+#if !defined(OFF)
+//yes
+sum += 600000.0;
+
+    #if defined(ON) && !defined(OFF)
+    //yes
+    sum += 80000000.0;
+
+        #if defined(OFF) || defined(ON)
+        //yes
+        sum += 900000000.0;
+
+            #if defined(ON) && defined(OFF)
+                //no
+                sum += 0.7;
+            #elif !defined(OFF)
+                //yes
+                sum += 7000000.0;
+            #endif
+
+        #endif
+
+    #endif
+
+#endif
+
+// sum should be 987600301.0
+    gl_Position = vec4(sum);
+}
diff --git a/Test/cppSimple.vert b/Test/cppSimple.vert
new file mode 100644 (file)
index 0000000..64eb2b8
--- /dev/null
@@ -0,0 +1,61 @@
+#define ON
+
+float sum = 0.0;
+
+void main()
+{
+
+#ifdef ON
+//yes
+sum += 1.0;
+#endif
+
+#ifdef OFF
+//no
+sum += 20.0;
+#endif
+
+#if defined(ON)
+//yes
+sum += 300.0;
+#endif
+
+#if defined(OFF)
+//no
+sum += 4000.0;
+#endif
+
+#if !defined(ON)
+//no
+sum += 50000.0;
+#endif
+
+#ifndef(OFF)
+//yes
+sum += 600000.0;
+#else
+//no
+sum += 0.6;
+#endif
+
+#if defined(ON) && defined(OFF)
+//no
+sum += 0.7;
+#elif !defined(OFF)
+//yes
+sum += 7000000.0;
+#endif
+
+#if defined(ON) && !defined(OFF)
+//yes
+sum += 80000000.0;
+#endif
+
+#if defined(OFF) || defined(ON)
+//yes
+sum += 900000000.0;
+#endif
+
+// sum should be 987600301.7
+    gl_Position = vec4(sum);
+}
index 93766c6..b1ce6c4 100644 (file)
@@ -12,4 +12,7 @@ versionsErrors.vert
 precision.frag
 nonSquare.vert
 matrixError.vert
-
+cppSimple.vert
+cppIndent.vert
+cppNest.vert
+cppComplexExpr.vert