Add tests for :? operator
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 29 Mar 2010 22:34:21 +0000 (15:34 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 29 Mar 2010 22:34:21 +0000 (15:34 -0700)
tests/condition-01.glsl [new file with mode: 0644]
tests/condition-02.glsl [new file with mode: 0644]
tests/condition-03.glsl [new file with mode: 0644]
tests/condition-04.glsl [new file with mode: 0644]
tests/condition-05.glsl [new file with mode: 0644]

diff --git a/tests/condition-01.glsl b/tests/condition-01.glsl
new file mode 100644 (file)
index 0000000..d89c313
--- /dev/null
@@ -0,0 +1,8 @@
+/* FAIL - :? condition is not bool scalar */
+
+uniform bvec4 a;
+
+void main()
+{
+  gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec4(0.0, 1.0, 0.0, 1.0);
+}
diff --git a/tests/condition-02.glsl b/tests/condition-02.glsl
new file mode 100644 (file)
index 0000000..cbd0e18
--- /dev/null
@@ -0,0 +1,8 @@
+/* FAIL - :? condition is not bool scalar */
+
+uniform float a;
+
+void main()
+{
+  gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec4(0.0, 1.0, 0.0, 1.0);
+}
diff --git a/tests/condition-03.glsl b/tests/condition-03.glsl
new file mode 100644 (file)
index 0000000..9af5d7a
--- /dev/null
@@ -0,0 +1,8 @@
+/* PASS */
+
+uniform bool a;
+
+void main()
+{
+  gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec4(0.0, 1.0, 0.0, 1.0);
+}
diff --git a/tests/condition-04.glsl b/tests/condition-04.glsl
new file mode 100644 (file)
index 0000000..f440b7e
--- /dev/null
@@ -0,0 +1,8 @@
+/* FAIL - type of second two operands must match */
+
+uniform bool a;
+
+void main()
+{
+  gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0);
+}
diff --git a/tests/condition-05.glsl b/tests/condition-05.glsl
new file mode 100644 (file)
index 0000000..3dff18f
--- /dev/null
@@ -0,0 +1,13 @@
+#version 120
+/* PASS */
+
+uniform bool a;
+uniform int b;
+
+void main()
+{
+  float x;
+
+  x = (a) ? 2.0 : b;
+  gl_Position = vec4(x);
+}