From cafd5f117a5193d45d75ee3ccdf52caded3d76ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jarkko=20P=C3=B6yry?= Date: Tue, 24 Mar 2015 13:34:36 -0700 Subject: [PATCH] Add negative tests for array initialization. - 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 | 40 ++++++++++- data/gles31/shaders/arrays.test | 77 ++++++++++++++++++++++ modules/gles31/functional/es31fFunctionalTests.cpp | 1 + 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 data/gles31/shaders/arrays.test diff --git a/data/gles3/shaders/arrays.test b/data/gles3/shaders/arrays.test index f627652..7b31d3c 100644 --- a/data/gles3/shaders/arrays.test +++ b/data/gles3/shaders/arrays.test @@ -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 index 0000000..51d1ab9 --- /dev/null +++ b/data/gles31/shaders/arrays.test @@ -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 diff --git a/modules/gles31/functional/es31fFunctionalTests.cpp b/modules/gles31/functional/es31fFunctionalTests.cpp index 3720cc0..5b99d2e 100644 --- a/modules/gles31/functional/es31fFunctionalTests.cpp +++ b/modules/gles31/functional/es31fFunctionalTests.cpp @@ -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)); -- 2.7.4