Add negative tests for array initialization.
authorJarkko Pöyry <jpoyry@google.com>
Tue, 24 Mar 2015 20:34:36 +0000 (13:34 -0700)
committerJarkko Pöyry <jpoyry@google.com>
Tue, 24 Mar 2015 20:34:36 +0000 (13:34 -0700)
- Rename constructor_c-styleN to constructor_c_styleN to avoid '-'
  character in test name.
- Add some additional initialization tests.
- Port initialization tests to GLES31.

Bug: 19639781
Change-Id: Id9488837cc24c82c3ff1ad31c49da3a238c6fee8

data/gles3/shaders/arrays.test
data/gles31/shaders/arrays.test [new file with mode: 0644]
modules/gles31/functional/es31fFunctionalTests.cpp

index f627652..7b31d3c 100644 (file)
@@ -1922,7 +1922,7 @@ group invalid "Invalid Functions"
                ""
        end
 
-       case constructor_c-style1
+       case constructor_c_style1
                version 300 es
                expect compile_fail
 
@@ -1941,7 +1941,7 @@ group invalid "Invalid Functions"
                ""
        end
 
-       case constructor_c-style2
+       case constructor_c_style2
                version 300 es
                expect compile_fail
 
@@ -1959,4 +1959,40 @@ group invalid "Invalid Functions"
                ""
        end
 
+       case constructor_c_style3
+               version 300 es
+               expect compile_fail
+
+               both ""
+                       #version 300 es
+                       precision mediump float;
+                       ${DECLARATIONS}
+
+                       void main ()
+                       {
+                               float a[] = float[3] { 1.0, 2.0, 3.0 };
+
+                               ${POSITION_FRAG_COLOR} = vec4(1.0);
+                       }
+               ""
+       end
+
+       case constructor_c_style4
+               version 300 es
+               expect compile_fail
+
+               both ""
+                       #version 300 es
+                       precision mediump float;
+                       ${DECLARATIONS}
+
+                       void main ()
+                       {
+                               float a[3] = { 1.0, 2.0, 3.0 };
+
+                               ${POSITION_FRAG_COLOR} = vec4(1.0);
+                       }
+               ""
+       end
+
 end # invalid
diff --git a/data/gles31/shaders/arrays.test b/data/gles31/shaders/arrays.test
new file mode 100644 (file)
index 0000000..51d1ab9
--- /dev/null
@@ -0,0 +1,77 @@
+
+group invalid "Invalid constructions"
+
+       case constructor_c_style1
+               version 310 es
+               expect compile_fail
+
+               both ""
+                       #version 310 es
+                       precision mediump float;
+                       ${DECLARATIONS}
+
+                       void main ()
+                       {
+                               float a[];
+                               a = float[3] { 1.0, 2.0, 3.0 };
+
+                               ${POSITION_FRAG_COLOR} = vec4(1.0);
+                       }
+               ""
+       end
+
+       case constructor_c_style2
+               version 310 es
+               expect compile_fail
+
+               both ""
+                       #version 310 es
+                       precision mediump float;
+                       ${DECLARATIONS}
+
+                       void main ()
+                       {
+                               float a[5] = { 1.0, 2.0, 3.0 };
+
+                               ${POSITION_FRAG_COLOR} = vec4(1.0);
+                       }
+               ""
+       end
+
+       case constructor_c_style3
+               version 310 es
+               expect compile_fail
+
+               both ""
+                       #version 310 es
+                       precision mediump float;
+                       ${DECLARATIONS}
+
+                       void main ()
+                       {
+                               float a[] = float[3] { 1.0, 2.0, 3.0 };
+
+                               ${POSITION_FRAG_COLOR} = vec4(1.0);
+                       }
+               ""
+       end
+
+       case constructor_c_style4
+               version 310 es
+               expect compile_fail
+
+               both ""
+                       #version 310 es
+                       precision mediump float;
+                       ${DECLARATIONS}
+
+                       void main ()
+                       {
+                               float a[3] = { 1.0, 2.0, 3.0 };
+
+                               ${POSITION_FRAG_COLOR} = vec4(1.0);
+                       }
+               ""
+       end
+
+end # invalid
index 3720cc0..5b99d2e 100644 (file)
@@ -189,6 +189,7 @@ public:
                addChild(new ShaderMultisampleInterpolationTests(m_context));
                addChild(new OpaqueTypeIndexingTests                    (m_context));
                addChild(new ShaderLibraryTest                                  (m_context, "functions", "Function Tests"));
+               addChild(new ShaderLibraryTest                                  (m_context, "arrays", "Arrays Tests"));
                addChild(new ShaderLibraryTest                                  (m_context, "arrays_of_arrays", "Arrays of Arrays Tests"));
                addChild(new ShaderLinkageTests                                 (m_context));
                addChild(new ShaderBuiltinConstantTests                 (m_context));