| // Copyright 2025 The Dawn & Tint Authors |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are met: |
| // |
| // 1. Redistributions of source code must retain the above copyright notice, this |
| // list of conditions and the following disclaimer. |
| // |
| // 2. Redistributions in binary form must reproduce the above copyright notice, |
| // this list of conditions and the following disclaimer in the documentation |
| // and/or other materials provided with the distribution. |
| // |
| // 3. Neither the name of the copyright holder nor the names of its |
| // contributors may be used to endorse or promote products derived from |
| // this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // File generated by 'tools/src/cmd/gen' using the template: |
| // src/tint/lang/core/enums_test.cc.tmpl |
| // |
| // To regenerate run: './tools/run gen' |
| // |
| // Do not modify this file directly |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| #include "src/tint/lang/core/enums.h" |
| |
| #include <gtest/gtest.h> |
| |
| #include <string> |
| |
| #include "src/tint/utils/text/string.h" |
| |
| namespace tint::core { |
| namespace { |
| |
| namespace parse_print_tests { |
| |
| struct AccessCase { |
| const char* string; |
| Access value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, AccessCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr AccessCase kValidAccessCases[] = { |
| {"read", Access::kRead}, |
| {"read_write", Access::kReadWrite}, |
| {"write", Access::kWrite}, |
| }; |
| |
| static constexpr AccessCase kInvalidAccessCases[] = { |
| {"ccad", Access::kUndefined}, {"3", Access::kUndefined}, |
| {"rVad", Access::kUndefined}, {"read1write", Access::kUndefined}, |
| {"reaJqqrite", Access::kUndefined}, {"rea7ll_write", Access::kUndefined}, |
| {"wrqHtpp", Access::kUndefined}, {"ve", Access::kUndefined}, |
| {"Grbe", Access::kUndefined}, |
| }; |
| |
| using AccessParseTest = testing::TestWithParam<AccessCase>; |
| |
| TEST_P(AccessParseTest, Parse) { |
| const char* string = GetParam().string; |
| Access expect = GetParam().value; |
| EXPECT_EQ(expect, ParseAccess(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidAccessCases, AccessParseTest, testing::ValuesIn(kValidAccessCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidAccessCases, |
| AccessParseTest, |
| testing::ValuesIn(kInvalidAccessCases)); |
| |
| using AccessPrintTest = testing::TestWithParam<AccessCase>; |
| |
| TEST_P(AccessPrintTest, Print) { |
| Access value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidAccessCases, AccessPrintTest, testing::ValuesIn(kValidAccessCases)); |
| |
| } // namespace parse_print_tests |
| |
| namespace parse_print_tests { |
| |
| struct AddressSpaceCase { |
| const char* string; |
| AddressSpace value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, AddressSpaceCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr AddressSpaceCase kValidAddressSpaceCases[] = { |
| {"function", AddressSpace::kFunction}, {"immediate", AddressSpace::kImmediate}, |
| {"pixel_local", AddressSpace::kPixelLocal}, {"private", AddressSpace::kPrivate}, |
| {"storage", AddressSpace::kStorage}, {"uniform", AddressSpace::kUniform}, |
| {"workgroup", AddressSpace::kWorkgroup}, |
| }; |
| |
| static constexpr AddressSpaceCase kInvalidAddressSpaceCases[] = { |
| {"fuviition", AddressSpace::kUndefined}, {"fuWWcti8n", AddressSpace::kUndefined}, |
| {"fxxcMion", AddressSpace::kUndefined}, {"iXediggte", AddressSpace::kUndefined}, |
| {"immXVue", AddressSpace::kUndefined}, {"3mmediate", AddressSpace::kUndefined}, |
| {"pixel_locaE", AddressSpace::kUndefined}, {"piTTel_locPl", AddressSpace::kUndefined}, |
| {"pxxdxel_loal", AddressSpace::kUndefined}, {"p44ivate", AddressSpace::kUndefined}, |
| {"prSSvaVVe", AddressSpace::kUndefined}, {"RriR22e", AddressSpace::kUndefined}, |
| {"sFra9e", AddressSpace::kUndefined}, {"stoage", AddressSpace::kUndefined}, |
| {"VOORRHge", AddressSpace::kUndefined}, {"unfoym", AddressSpace::kUndefined}, |
| {"llnnrrf77rm", AddressSpace::kUndefined}, {"unif4r00", AddressSpace::kUndefined}, |
| {"wooogup", AddressSpace::kUndefined}, {"wozzgrop", AddressSpace::kUndefined}, |
| {"o11pkgriiu", AddressSpace::kUndefined}, |
| }; |
| |
| using AddressSpaceParseTest = testing::TestWithParam<AddressSpaceCase>; |
| |
| TEST_P(AddressSpaceParseTest, Parse) { |
| const char* string = GetParam().string; |
| AddressSpace expect = GetParam().value; |
| EXPECT_EQ(expect, ParseAddressSpace(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidAddressSpaceCases, |
| AddressSpaceParseTest, |
| testing::ValuesIn(kValidAddressSpaceCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidAddressSpaceCases, |
| AddressSpaceParseTest, |
| testing::ValuesIn(kInvalidAddressSpaceCases)); |
| |
| using AddressSpacePrintTest = testing::TestWithParam<AddressSpaceCase>; |
| |
| TEST_P(AddressSpacePrintTest, Print) { |
| AddressSpace value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidAddressSpaceCases, |
| AddressSpacePrintTest, |
| testing::ValuesIn(kValidAddressSpaceCases)); |
| |
| } // namespace parse_print_tests |
| |
| namespace interpolation_sampling_tests { |
| namespace parse_print_tests { |
| |
| struct InterpolationSamplingCase { |
| const char* string; |
| InterpolationSampling value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, InterpolationSamplingCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr InterpolationSamplingCase kValidInterpolationSamplingCases[] = { |
| {"center", InterpolationSampling::kCenter}, {"centroid", InterpolationSampling::kCentroid}, |
| {"either", InterpolationSampling::kEither}, {"first", InterpolationSampling::kFirst}, |
| {"sample", InterpolationSampling::kSample}, |
| }; |
| |
| static constexpr InterpolationSamplingCase kInvalidInterpolationSamplingCases[] = { |
| {"ceXXter", InterpolationSampling::kUndefined}, |
| {"55IIntnn99", InterpolationSampling::kUndefined}, |
| {"aHHrrnteSS", InterpolationSampling::kUndefined}, |
| {"ckknod", InterpolationSampling::kUndefined}, |
| {"gjnrRRi", InterpolationSampling::kUndefined}, |
| {"cnbrid", InterpolationSampling::kUndefined}, |
| {"eithjr", InterpolationSampling::kUndefined}, |
| {"ether", InterpolationSampling::kUndefined}, |
| {"ehqr", InterpolationSampling::kUndefined}, |
| {"Nirst", InterpolationSampling::kUndefined}, |
| {"frvv", InterpolationSampling::kUndefined}, |
| {"fisQQ", InterpolationSampling::kUndefined}, |
| {"aplrf", InterpolationSampling::kUndefined}, |
| {"sampje", InterpolationSampling::kUndefined}, |
| {"s82wNNe", InterpolationSampling::kUndefined}, |
| }; |
| |
| using InterpolationSamplingParseTest = testing::TestWithParam<InterpolationSamplingCase>; |
| |
| TEST_P(InterpolationSamplingParseTest, Parse) { |
| const char* string = GetParam().string; |
| InterpolationSampling expect = GetParam().value; |
| EXPECT_EQ(expect, ParseInterpolationSampling(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidInterpolationSamplingCases, |
| InterpolationSamplingParseTest, |
| testing::ValuesIn(kValidInterpolationSamplingCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidInterpolationSamplingCases, |
| InterpolationSamplingParseTest, |
| testing::ValuesIn(kInvalidInterpolationSamplingCases)); |
| |
| using InterpolationSamplingPrintTest = testing::TestWithParam<InterpolationSamplingCase>; |
| |
| TEST_P(InterpolationSamplingPrintTest, Print) { |
| InterpolationSampling value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidInterpolationSamplingCases, |
| InterpolationSamplingPrintTest, |
| testing::ValuesIn(kValidInterpolationSamplingCases)); |
| |
| } // namespace parse_print_tests |
| } // namespace interpolation_sampling_tests |
| |
| namespace interpolation_type_tests { |
| namespace parse_print_tests { |
| |
| struct InterpolationTypeCase { |
| const char* string; |
| InterpolationType value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, InterpolationTypeCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr InterpolationTypeCase kValidInterpolationTypeCases[] = { |
| {"flat", InterpolationType::kFlat}, |
| {"linear", InterpolationType::kLinear}, |
| {"perspective", InterpolationType::kPerspective}, |
| }; |
| |
| static constexpr InterpolationTypeCase kInvalidInterpolationTypeCases[] = { |
| {"fat", InterpolationType::kUndefined}, {"flrrt", InterpolationType::kUndefined}, |
| {"fGat", InterpolationType::kUndefined}, {"linFFar", InterpolationType::kUndefined}, |
| {"lna", InterpolationType::kUndefined}, {"lrrnea", InterpolationType::kUndefined}, |
| {"persetive", InterpolationType::kUndefined}, {"XrspJJcDive", InterpolationType::kUndefined}, |
| {"pesect8v", InterpolationType::kUndefined}, |
| }; |
| |
| using InterpolationTypeParseTest = testing::TestWithParam<InterpolationTypeCase>; |
| |
| TEST_P(InterpolationTypeParseTest, Parse) { |
| const char* string = GetParam().string; |
| InterpolationType expect = GetParam().value; |
| EXPECT_EQ(expect, ParseInterpolationType(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidInterpolationTypeCases, |
| InterpolationTypeParseTest, |
| testing::ValuesIn(kValidInterpolationTypeCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidInterpolationTypeCases, |
| InterpolationTypeParseTest, |
| testing::ValuesIn(kInvalidInterpolationTypeCases)); |
| |
| using InterpolationTypePrintTest = testing::TestWithParam<InterpolationTypeCase>; |
| |
| TEST_P(InterpolationTypePrintTest, Print) { |
| InterpolationType value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidInterpolationTypeCases, |
| InterpolationTypePrintTest, |
| testing::ValuesIn(kValidInterpolationTypeCases)); |
| |
| } // namespace parse_print_tests |
| } // namespace interpolation_type_tests |
| |
| namespace parse_print_tests { |
| |
| struct TexelFormatCase { |
| const char* string; |
| TexelFormat value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, TexelFormatCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr TexelFormatCase kValidTexelFormatCases[] = { |
| {"bgra8unorm", TexelFormat::kBgra8Unorm}, {"r32float", TexelFormat::kR32Float}, |
| {"r32sint", TexelFormat::kR32Sint}, {"r32uint", TexelFormat::kR32Uint}, |
| {"r8unorm", TexelFormat::kR8Unorm}, {"rg32float", TexelFormat::kRg32Float}, |
| {"rg32sint", TexelFormat::kRg32Sint}, {"rg32uint", TexelFormat::kRg32Uint}, |
| {"rgba16float", TexelFormat::kRgba16Float}, {"rgba16sint", TexelFormat::kRgba16Sint}, |
| {"rgba16uint", TexelFormat::kRgba16Uint}, {"rgba32float", TexelFormat::kRgba32Float}, |
| {"rgba32sint", TexelFormat::kRgba32Sint}, {"rgba32uint", TexelFormat::kRgba32Uint}, |
| {"rgba8sint", TexelFormat::kRgba8Sint}, {"rgba8snorm", TexelFormat::kRgba8Snorm}, |
| {"rgba8uint", TexelFormat::kRgba8Uint}, {"rgba8unorm", TexelFormat::kRgba8Unorm}, |
| }; |
| |
| static constexpr TexelFormatCase kInvalidTexelFormatCases[] = { |
| {"bg811kor", TexelFormat::kUndefined}, {"bgr8unorm", TexelFormat::kUndefined}, |
| {"bgJa8unom", TexelFormat::kUndefined}, {"r32fcoat", TexelFormat::kUndefined}, |
| {"r32floOt", TexelFormat::kUndefined}, {"r32floKK_vtt", TexelFormat::kUndefined}, |
| {"xx8sint", TexelFormat::kUndefined}, {"__q32Fn", TexelFormat::kUndefined}, |
| {"r32qint", TexelFormat::kUndefined}, {"3332Oint", TexelFormat::kUndefined}, |
| {"rtt6ui9oQQ", TexelFormat::kUndefined}, {"r3ui66t", TexelFormat::kUndefined}, |
| {"ruOozz66", TexelFormat::kUndefined}, {"r8unyyrm", TexelFormat::kUndefined}, |
| {"Z8HHrZ", TexelFormat::kUndefined}, {"rWW44floaq", TexelFormat::kUndefined}, |
| {"rOO32loat", TexelFormat::kUndefined}, {"r32flYat", TexelFormat::kUndefined}, |
| {"rsint", TexelFormat::kUndefined}, {"rg2Fint", TexelFormat::kUndefined}, |
| {"wg32sin", TexelFormat::kUndefined}, {"K32unff", TexelFormat::kUndefined}, |
| {"qg3KKuint", TexelFormat::kUndefined}, {"rF3mmu3nt", TexelFormat::kUndefined}, |
| {"rgba16floa", TexelFormat::kUndefined}, {"rgba6floaq", TexelFormat::kUndefined}, |
| {"rgba1bbflbt", TexelFormat::kUndefined}, {"rba16iint", TexelFormat::kUndefined}, |
| {"qgba16siOt", TexelFormat::kUndefined}, {"rgba16siTTvv", TexelFormat::kUndefined}, |
| {"rgFFa16uint", TexelFormat::kUndefined}, {"rg00Q6uPnt", TexelFormat::kUndefined}, |
| {"rgbaP6uint", TexelFormat::kUndefined}, {"rgb32fssoa77", TexelFormat::kUndefined}, |
| {"rgbbbR32floCt", TexelFormat::kUndefined}, {"rgba32floaXX", TexelFormat::kUndefined}, |
| {"CqgbaOO2sint", TexelFormat::kUndefined}, {"rgbu32snL", TexelFormat::kUndefined}, |
| {"rgba3Xsint", TexelFormat::kUndefined}, {"rgba32unt", TexelFormat::kUndefined}, |
| {"ba32qqin", TexelFormat::kUndefined}, {"rgba32uin22", TexelFormat::kUndefined}, |
| {"rzzyaXsi0t", TexelFormat::kUndefined}, {"rPbi8sint", TexelFormat::kUndefined}, |
| {"rgaCnnint", TexelFormat::kUndefined}, {"ba8snoqqHHA", TexelFormat::kUndefined}, |
| {"rga8snorm", TexelFormat::kUndefined}, {"rgfa8sKKo", TexelFormat::kUndefined}, |
| {"lggba8uP", TexelFormat::kUndefined}, {"rga8uint", TexelFormat::kUndefined}, |
| {"4gbacTNint", TexelFormat::kUndefined}, {"rgla8unppr7", TexelFormat::kUndefined}, |
| {"rg8zznNNrm", TexelFormat::kUndefined}, {"bXXbauuuorm", TexelFormat::kUndefined}, |
| }; |
| |
| using TexelFormatParseTest = testing::TestWithParam<TexelFormatCase>; |
| |
| TEST_P(TexelFormatParseTest, Parse) { |
| const char* string = GetParam().string; |
| TexelFormat expect = GetParam().value; |
| EXPECT_EQ(expect, ParseTexelFormat(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidTexelFormatCases, |
| TexelFormatParseTest, |
| testing::ValuesIn(kValidTexelFormatCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidTexelFormatCases, |
| TexelFormatParseTest, |
| testing::ValuesIn(kInvalidTexelFormatCases)); |
| |
| using TexelFormatPrintTest = testing::TestWithParam<TexelFormatCase>; |
| |
| TEST_P(TexelFormatPrintTest, Print) { |
| TexelFormat value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidTexelFormatCases, |
| TexelFormatPrintTest, |
| testing::ValuesIn(kValidTexelFormatCases)); |
| |
| } // namespace parse_print_tests |
| |
| namespace parse_print_tests { |
| |
| struct BuiltinTypeCase { |
| const char* string; |
| BuiltinType value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, BuiltinTypeCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr BuiltinTypeCase kValidBuiltinTypeCases[] = { |
| {"__atomic_compare_exchange_result_i32", BuiltinType::kAtomicCompareExchangeResultI32}, |
| {"__atomic_compare_exchange_result_u32", BuiltinType::kAtomicCompareExchangeResultU32}, |
| {"__frexp_result_abstract", BuiltinType::kFrexpResultAbstract}, |
| {"__frexp_result_f16", BuiltinType::kFrexpResultF16}, |
| {"__frexp_result_f32", BuiltinType::kFrexpResultF32}, |
| {"__frexp_result_vec2_abstract", BuiltinType::kFrexpResultVec2Abstract}, |
| {"__frexp_result_vec2_f16", BuiltinType::kFrexpResultVec2F16}, |
| {"__frexp_result_vec2_f32", BuiltinType::kFrexpResultVec2F32}, |
| {"__frexp_result_vec3_abstract", BuiltinType::kFrexpResultVec3Abstract}, |
| {"__frexp_result_vec3_f16", BuiltinType::kFrexpResultVec3F16}, |
| {"__frexp_result_vec3_f32", BuiltinType::kFrexpResultVec3F32}, |
| {"__frexp_result_vec4_abstract", BuiltinType::kFrexpResultVec4Abstract}, |
| {"__frexp_result_vec4_f16", BuiltinType::kFrexpResultVec4F16}, |
| {"__frexp_result_vec4_f32", BuiltinType::kFrexpResultVec4F32}, |
| {"__modf_result_abstract", BuiltinType::kModfResultAbstract}, |
| {"__modf_result_f16", BuiltinType::kModfResultF16}, |
| {"__modf_result_f32", BuiltinType::kModfResultF32}, |
| {"__modf_result_vec2_abstract", BuiltinType::kModfResultVec2Abstract}, |
| {"__modf_result_vec2_f16", BuiltinType::kModfResultVec2F16}, |
| {"__modf_result_vec2_f32", BuiltinType::kModfResultVec2F32}, |
| {"__modf_result_vec3_abstract", BuiltinType::kModfResultVec3Abstract}, |
| {"__modf_result_vec3_f16", BuiltinType::kModfResultVec3F16}, |
| {"__modf_result_vec3_f32", BuiltinType::kModfResultVec3F32}, |
| {"__modf_result_vec4_abstract", BuiltinType::kModfResultVec4Abstract}, |
| {"__modf_result_vec4_f16", BuiltinType::kModfResultVec4F16}, |
| {"__modf_result_vec4_f32", BuiltinType::kModfResultVec4F32}, |
| {"array", BuiltinType::kArray}, |
| {"atomic", BuiltinType::kAtomic}, |
| {"binding_array", BuiltinType::kBindingArray}, |
| {"bool", BuiltinType::kBool}, |
| {"f16", BuiltinType::kF16}, |
| {"f32", BuiltinType::kF32}, |
| {"i32", BuiltinType::kI32}, |
| {"i8", BuiltinType::kI8}, |
| {"input_attachment", BuiltinType::kInputAttachment}, |
| {"mat2x2", BuiltinType::kMat2X2}, |
| {"mat2x2f", BuiltinType::kMat2X2F}, |
| {"mat2x2h", BuiltinType::kMat2X2H}, |
| {"mat2x3", BuiltinType::kMat2X3}, |
| {"mat2x3f", BuiltinType::kMat2X3F}, |
| {"mat2x3h", BuiltinType::kMat2X3H}, |
| {"mat2x4", BuiltinType::kMat2X4}, |
| {"mat2x4f", BuiltinType::kMat2X4F}, |
| {"mat2x4h", BuiltinType::kMat2X4H}, |
| {"mat3x2", BuiltinType::kMat3X2}, |
| {"mat3x2f", BuiltinType::kMat3X2F}, |
| {"mat3x2h", BuiltinType::kMat3X2H}, |
| {"mat3x3", BuiltinType::kMat3X3}, |
| {"mat3x3f", BuiltinType::kMat3X3F}, |
| {"mat3x3h", BuiltinType::kMat3X3H}, |
| {"mat3x4", BuiltinType::kMat3X4}, |
| {"mat3x4f", BuiltinType::kMat3X4F}, |
| {"mat3x4h", BuiltinType::kMat3X4H}, |
| {"mat4x2", BuiltinType::kMat4X2}, |
| {"mat4x2f", BuiltinType::kMat4X2F}, |
| {"mat4x2h", BuiltinType::kMat4X2H}, |
| {"mat4x3", BuiltinType::kMat4X3}, |
| {"mat4x3f", BuiltinType::kMat4X3F}, |
| {"mat4x3h", BuiltinType::kMat4X3H}, |
| {"mat4x4", BuiltinType::kMat4X4}, |
| {"mat4x4f", BuiltinType::kMat4X4F}, |
| {"mat4x4h", BuiltinType::kMat4X4H}, |
| {"ptr", BuiltinType::kPtr}, |
| {"sampler", BuiltinType::kSampler}, |
| {"sampler_comparison", BuiltinType::kSamplerComparison}, |
| {"subgroup_matrix_left", BuiltinType::kSubgroupMatrixLeft}, |
| {"subgroup_matrix_result", BuiltinType::kSubgroupMatrixResult}, |
| {"subgroup_matrix_right", BuiltinType::kSubgroupMatrixRight}, |
| {"texture_1d", BuiltinType::kTexture1D}, |
| {"texture_2d", BuiltinType::kTexture2D}, |
| {"texture_2d_array", BuiltinType::kTexture2DArray}, |
| {"texture_3d", BuiltinType::kTexture3D}, |
| {"texture_cube", BuiltinType::kTextureCube}, |
| {"texture_cube_array", BuiltinType::kTextureCubeArray}, |
| {"texture_depth_2d", BuiltinType::kTextureDepth2D}, |
| {"texture_depth_2d_array", BuiltinType::kTextureDepth2DArray}, |
| {"texture_depth_cube", BuiltinType::kTextureDepthCube}, |
| {"texture_depth_cube_array", BuiltinType::kTextureDepthCubeArray}, |
| {"texture_depth_multisampled_2d", BuiltinType::kTextureDepthMultisampled2D}, |
| {"texture_external", BuiltinType::kTextureExternal}, |
| {"texture_multisampled_2d", BuiltinType::kTextureMultisampled2D}, |
| {"texture_storage_1d", BuiltinType::kTextureStorage1D}, |
| {"texture_storage_2d", BuiltinType::kTextureStorage2D}, |
| {"texture_storage_2d_array", BuiltinType::kTextureStorage2DArray}, |
| {"texture_storage_3d", BuiltinType::kTextureStorage3D}, |
| {"u32", BuiltinType::kU32}, |
| {"u8", BuiltinType::kU8}, |
| {"vec2", BuiltinType::kVec2}, |
| {"vec2f", BuiltinType::kVec2F}, |
| {"vec2h", BuiltinType::kVec2H}, |
| {"vec2i", BuiltinType::kVec2I}, |
| {"vec2u", BuiltinType::kVec2U}, |
| {"vec3", BuiltinType::kVec3}, |
| {"vec3f", BuiltinType::kVec3F}, |
| {"vec3h", BuiltinType::kVec3H}, |
| {"vec3i", BuiltinType::kVec3I}, |
| {"vec3u", BuiltinType::kVec3U}, |
| {"vec4", BuiltinType::kVec4}, |
| {"vec4f", BuiltinType::kVec4F}, |
| {"vec4h", BuiltinType::kVec4H}, |
| {"vec4i", BuiltinType::kVec4I}, |
| {"vec4u", BuiltinType::kVec4U}, |
| }; |
| |
| static constexpr BuiltinTypeCase kInvalidBuiltinTypeCases[] = { |
| {"__atomic_compre_exchange_result_i32", BuiltinType::kUndefined}, |
| {"__atomic_compareexhange_r88sult_i3K", BuiltinType::kUndefined}, |
| {"__atomiq_compare_exc9nge_result_i32", BuiltinType::kUndefined}, |
| {"__atomic_compare_exchange_result_u112", BuiltinType::kUndefined}, |
| {"__tomic_coiipare_exchFn22e_result_u32", BuiltinType::kUndefined}, |
| {"_77atomic_compare_exchange_rsult_u32", BuiltinType::kUndefined}, |
| {"__frexN_result_abstra2t", BuiltinType::kUndefined}, |
| {"__frexpVVresult_abstract", BuiltinType::kUndefined}, |
| {"__frexp_Fesult11WWbstrwct", BuiltinType::kUndefined}, |
| {"__fexp_result_f1ww", BuiltinType::kUndefined}, |
| {"__frexp_reDult_f16", BuiltinType::kUndefined}, |
| {"K_frexp_resultf16", BuiltinType::kUndefined}, |
| {"__frePPp_resu1rt_f3h", BuiltinType::kUndefined}, |
| {"__frexp_result_f3", BuiltinType::kUndefined}, |
| {"__frexp_resYYlt_f32", BuiltinType::kUndefined}, |
| {"HH_frexp_resulV_vec_kkbttract", BuiltinType::kUndefined}, |
| {"__frexp_resrrlt_vec2_abstract", BuiltinType::kUndefined}, |
| {"__frexpWWrsssult_vec2_abstact", BuiltinType::kUndefined}, |
| {"_fYexp_result_vec2_f16", BuiltinType::kUndefined}, |
| {"__frexp_rqsul_vec2_f1L", BuiltinType::kUndefined}, |
| {"_frevuup_re22ult_vecf_f16", BuiltinType::kUndefined}, |
| {"__frexp_resut_ec2_f32", BuiltinType::kUndefined}, |
| {"__frep_result_vec2_f3Y", BuiltinType::kUndefined}, |
| {"__frexpYYresy7lt_Eec2_f32", BuiltinType::kUndefined}, |
| {"__frexp_result_vc3Madsooract", BuiltinType::kUndefined}, |
| {"__frexp_resul_vec3_abMMtract", BuiltinType::kUndefined}, |
| {"__frexp_result_vec355abstract", BuiltinType::kUndefined}, |
| {"__frexp_reul_vec3Nf16", BuiltinType::kUndefined}, |
| {"__fOexp_re3ult_ec333f16", BuiltinType::kUndefined}, |
| {"__frexp_result_vec3_316", BuiltinType::kUndefined}, |
| {"__frexp_esuIt_vem3_f32", BuiltinType::kUndefined}, |
| {"nn_frexp_resurtKvec3_f32", BuiltinType::kUndefined}, |
| {"_frexp_reult_vec3_3X", BuiltinType::kUndefined}, |
| {"_frexppresultLLvec4_abstIact", BuiltinType::kUndefined}, |
| {"_frexp_result_vecf_astract", BuiltinType::kUndefined}, |
| {"__fRRex_reUult_Yec4_abstrDct", BuiltinType::kUndefined}, |
| {"__frexphresult_vec4_f16", BuiltinType::kUndefined}, |
| {"__frexqresutIIvuuc4_f16", BuiltinType::kUndefined}, |
| {"H_frexp_result_vec4_f16", BuiltinType::kUndefined}, |
| {"_frexp_resultQQvec4vvf3", BuiltinType::kUndefined}, |
| {"__frexperesultve664_f2", BuiltinType::kUndefined}, |
| {"_W7rxO_result_vec4_f32", BuiltinType::kUndefined}, |
| {"__modf_DDes0lt_a55stract", BuiltinType::kUndefined}, |
| {"__modf_rIIsult_Hbstract", BuiltinType::kUndefined}, |
| {"_modf_result_abstract", BuiltinType::kUndefined}, |
| {"__modf_rsultrf16", BuiltinType::kUndefined}, |
| {"__modf_result_l16", BuiltinType::kUndefined}, |
| {"GmJJdf_rsultt_f16", BuiltinType::kUndefined}, |
| {"__modf_reslt_fy2", BuiltinType::kUndefined}, |
| {"__modf_result_32", BuiltinType::kUndefined}, |
| {"II_modf_rBBsult_f32", BuiltinType::kUndefined}, |
| {"__moTTf_resu33t_vec2abstr8Kct", BuiltinType::kUndefined}, |
| {"__mdddf_YnnesUUlt_vSSc2_abstract", BuiltinType::kUndefined}, |
| {"x_mCCdf_resultdve52_absZract", BuiltinType::kUndefined}, |
| {"__mkkdf_result_vecq_f16", BuiltinType::kUndefined}, |
| {"_005opf_iisult_vec2_f16", BuiltinType::kUndefined}, |
| {"__modf_nnesult_vec2IIf16", BuiltinType::kUndefined}, |
| {"__moccf_result_vW2K32", BuiltinType::kUndefined}, |
| {"__mod_sulKK_vec2_f32", BuiltinType::kUndefined}, |
| {"__modf_result_66ec2_f32", BuiltinType::kUndefined}, |
| {"_KKmoEf_reslPP_vec3_astract", BuiltinType::kUndefined}, |
| {"__modf_resuxt_vec3_abstract", BuiltinType::kUndefined}, |
| {"__mqdf_result_vec3_abstract", BuiltinType::kUndefined}, |
| {"rSSodf_reyyult_vec3_MM16", BuiltinType::kUndefined}, |
| {"__mdfuresult_ve3_f16", BuiltinType::kUndefined}, |
| {"__mod_rSsult_ve3f16", BuiltinType::kUndefined}, |
| {"__modf_rFFsult_vec3_f52", BuiltinType::kUndefined}, |
| {"__rz44df_result_vec3_f32", BuiltinType::kUndefined}, |
| {"__mo_result_vec3WW32", BuiltinType::kUndefined}, |
| {"__mZZdf_result_vJJc4_abstrXct", BuiltinType::kUndefined}, |
| {"__PPodf_result_vec4_astract", BuiltinType::kUndefined}, |
| {"__mcdf_result_vec4_abstract", BuiltinType::kUndefined}, |
| {"__PPodf_resulll_v6c4_f16", BuiltinType::kUndefined}, |
| {"__m99df_result_vecyyf16", BuiltinType::kUndefined}, |
| {"__modf_JesultKKvec4_f16", BuiltinType::kUndefined}, |
| {"_modf_result_vec4_f_x", BuiltinType::kUndefined}, |
| {"yyodK_result_ve4_f32", BuiltinType::kUndefined}, |
| {"__mokf_Vesult_vecz_f32", BuiltinType::kUndefined}, |
| {"arKSy", BuiltinType::kUndefined}, |
| {"aray", BuiltinType::kUndefined}, |
| {"rraVV", BuiltinType::kUndefined}, |
| {"aAAomiI", BuiltinType::kUndefined}, |
| {"jbmc", BuiltinType::kUndefined}, |
| {"o4YYi", BuiltinType::kUndefined}, |
| {"binding_aray", BuiltinType::kUndefined}, |
| {"binxxng11rray", BuiltinType::kUndefined}, |
| {"bndinm_arrccJ", BuiltinType::kUndefined}, |
| {"bJJl", BuiltinType::kUndefined}, |
| {"lDCfoU", BuiltinType::kUndefined}, |
| {"bogl", BuiltinType::kUndefined}, |
| {"0", BuiltinType::kUndefined}, |
| {"6ww", BuiltinType::kUndefined}, |
| {"fM", BuiltinType::kUndefined}, |
| {"td", BuiltinType::kUndefined}, |
| {"W3K", BuiltinType::kUndefined}, |
| {"fzzee", BuiltinType::kUndefined}, |
| {"", BuiltinType::kUndefined}, |
| {"w9", BuiltinType::kUndefined}, |
| {"43nn", BuiltinType::kUndefined}, |
| {"ll", BuiltinType::kUndefined}, |
| {"4o", BuiltinType::kUndefined}, |
| {"gwE", BuiltinType::kUndefined}, |
| {"inpg_attachment", BuiltinType::kUndefined}, |
| {"inSu_atachment", BuiltinType::kUndefined}, |
| {"inut_aaatchent", BuiltinType::kUndefined}, |
| {"mat2ZRRT", BuiltinType::kUndefined}, |
| {"Oa8T2x2", BuiltinType::kUndefined}, |
| {"mat2002", BuiltinType::kUndefined}, |
| {"mBBt2x2f", BuiltinType::kUndefined}, |
| {"at2ppM", BuiltinType::kUndefined}, |
| {"matOO2f", BuiltinType::kUndefined}, |
| {"mGG2x2G", BuiltinType::kUndefined}, |
| {"mHHt2x11h", BuiltinType::kUndefined}, |
| {"eat2x6Fh", BuiltinType::kUndefined}, |
| {"matx", BuiltinType::kUndefined}, |
| {"mKl2ii3", BuiltinType::kUndefined}, |
| {"at2x3", BuiltinType::kUndefined}, |
| {"IIvvt2x39", BuiltinType::kUndefined}, |
| {"mat23f", BuiltinType::kUndefined}, |
| {"mat2h3f", BuiltinType::kUndefined}, |
| {"mllt2xPzz", BuiltinType::kUndefined}, |
| {"t3h", BuiltinType::kUndefined}, |
| {"mtffxqqh", BuiltinType::kUndefined}, |
| {"maJdd2x", BuiltinType::kUndefined}, |
| {"marXXz", BuiltinType::kUndefined}, |
| {"2t2x4", BuiltinType::kUndefined}, |
| {"maN2yy4f", BuiltinType::kUndefined}, |
| {"mt2O4", BuiltinType::kUndefined}, |
| {"uZtrx4f", BuiltinType::kUndefined}, |
| {"latdde24h", BuiltinType::kUndefined}, |
| {"matVVh", BuiltinType::kUndefined}, |
| {"1IIt2x4", BuiltinType::kUndefined}, |
| {"mab3x2", BuiltinType::kUndefined}, |
| {"t7i2", BuiltinType::kUndefined}, |
| {"maio3x2", BuiltinType::kUndefined}, |
| {"mat25", BuiltinType::kUndefined}, |
| {"at3xSf", BuiltinType::kUndefined}, |
| {"mat22f", BuiltinType::kUndefined}, |
| {"maG1C2h", BuiltinType::kUndefined}, |
| {"maff382h", BuiltinType::kUndefined}, |
| {"t3x2h", BuiltinType::kUndefined}, |
| {"maSJJ3x3", BuiltinType::kUndefined}, |
| {"9t33", BuiltinType::kUndefined}, |
| {"TTaJJbbx3", BuiltinType::kUndefined}, |
| {"66a3xf", BuiltinType::kUndefined}, |
| {"ut3x366", BuiltinType::kUndefined}, |
| {"aW3x3f", BuiltinType::kUndefined}, |
| {"mtx3h", BuiltinType::kUndefined}, |
| {"mOt3x3", BuiltinType::kUndefined}, |
| {"THat3xBB", BuiltinType::kUndefined}, |
| {"maR3x4", BuiltinType::kUndefined}, |
| {"VLLa30", BuiltinType::kUndefined}, |
| {"at3KOO", BuiltinType::kUndefined}, |
| {"magw3xf", BuiltinType::kUndefined}, |
| {"hht3L4f", BuiltinType::kUndefined}, |
| {"aKii3xf", BuiltinType::kUndefined}, |
| {"ma3x4h", BuiltinType::kUndefined}, |
| {"UUa3884", BuiltinType::kUndefined}, |
| {"rrvvt3x4h", BuiltinType::kUndefined}, |
| {"mmtxw", BuiltinType::kUndefined}, |
| {"mj44x2", BuiltinType::kUndefined}, |
| {"matXx2", BuiltinType::kUndefined}, |
| {"mat8x2f", BuiltinType::kUndefined}, |
| {"mvEE4x2f", BuiltinType::kUndefined}, |
| {"mai94zz", BuiltinType::kUndefined}, |
| {"mQQJJnxGGh", BuiltinType::kUndefined}, |
| {"mass4x2h", BuiltinType::kUndefined}, |
| {"matKxPh", BuiltinType::kUndefined}, |
| {"atpttx", BuiltinType::kUndefined}, |
| {"atx3", BuiltinType::kUndefined}, |
| {"maMM4x3", BuiltinType::kUndefined}, |
| {"maJ04x3f", BuiltinType::kUndefined}, |
| {"V8x3", BuiltinType::kUndefined}, |
| {"maKggx3hh", BuiltinType::kUndefined}, |
| {"maf4x3h", BuiltinType::kUndefined}, |
| {"matQ7x3h", BuiltinType::kUndefined}, |
| {"mat4YYh", BuiltinType::kUndefined}, |
| {"mak4S", BuiltinType::kUndefined}, |
| {"nt422", BuiltinType::kUndefined}, |
| {"mFFx4", BuiltinType::kUndefined}, |
| {"uGGtIUPP4f", BuiltinType::kUndefined}, |
| {"EEvFx4f", BuiltinType::kUndefined}, |
| {"ddtBBDDef", BuiltinType::kUndefined}, |
| {"m55tMccE4", BuiltinType::kUndefined}, |
| {"aKKx4", BuiltinType::kUndefined}, |
| {"mat4x4R", BuiltinType::kUndefined}, |
| {"D9", BuiltinType::kUndefined}, |
| {"pr", BuiltinType::kUndefined}, |
| {"aI", BuiltinType::kUndefined}, |
| {"s77mpler", BuiltinType::kUndefined}, |
| {"samIler", BuiltinType::kUndefined}, |
| {"sdpler", BuiltinType::kUndefined}, |
| {"sampler_compaison", BuiltinType::kUndefined}, |
| {"sampler_copatisn", BuiltinType::kUndefined}, |
| {"sampler33comXXcrison", BuiltinType::kUndefined}, |
| {"subroEp_matrix_left", BuiltinType::kUndefined}, |
| {"sbgroup_matriXX_left", BuiltinType::kUndefined}, |
| {"subgroup_matrix_Bxxft", BuiltinType::kUndefined}, |
| {"ubgrop_matrGG_result", BuiltinType::kUndefined}, |
| {"subgroup_matrix_resul66", BuiltinType::kUndefined}, |
| {"su0rvup_matrix_TTsult", BuiltinType::kUndefined}, |
| {"subrouk_atix_righ", BuiltinType::kUndefined}, |
| {"spbgrup_matrix_right", BuiltinType::kUndefined}, |
| {"subgroup_mr11x_right", BuiltinType::kUndefined}, |
| {"BJExture_1d", BuiltinType::kUndefined}, |
| {"mexturexqII", BuiltinType::kUndefined}, |
| {"textFr_1d", BuiltinType::kUndefined}, |
| {"textre_2d", BuiltinType::kUndefined}, |
| {"textuhHeD2d", BuiltinType::kUndefined}, |
| {"22exHr_d", BuiltinType::kUndefined}, |
| {"textre2d_array", BuiltinType::kUndefined}, |
| {"texture_2d_aray", BuiltinType::kUndefined}, |
| {"txture_2d_array", BuiltinType::kUndefined}, |
| {"textddre_3d", BuiltinType::kUndefined}, |
| {"OextuPe_3d", BuiltinType::kUndefined}, |
| {"baexBue_d", BuiltinType::kUndefined}, |
| {"t00ture_cube", BuiltinType::kUndefined}, |
| {"texturh_cube", BuiltinType::kUndefined}, |
| {"teYYtue_cgbe", BuiltinType::kUndefined}, |
| {"texturO_cube_array", BuiltinType::kUndefined}, |
| {"txturh_cbe_array", BuiltinType::kUndefined}, |
| {"fEexture_cube_pprra", BuiltinType::kUndefined}, |
| {"texture_veph_2d", BuiltinType::kUndefined}, |
| {"textur_depth_zzd", BuiltinType::kUndefined}, |
| {"textue_depth_2d", BuiltinType::kUndefined}, |
| {"OOture_diipth_2d_arJay", BuiltinType::kUndefined}, |
| {"tfxGure_depth_2d_array", BuiltinType::kUndefined}, |
| {"textureTTde22th_2d_array", BuiltinType::kUndefined}, |
| {"texture_deptl_cube", BuiltinType::kUndefined}, |
| {"texture_bepth_cube", BuiltinType::kUndefined}, |
| {"textre_depth_cubBB", BuiltinType::kUndefined}, |
| {"tPPxture_depth_cubeIIarraX", BuiltinType::kUndefined}, |
| {"texture_depth_cjjbe_array", BuiltinType::kUndefined}, |
| {"tecct_re_depth_cube_array", BuiltinType::kUndefined}, |
| {"zzexxxre_dSSpth_m6ltisampled_2d", BuiltinType::kUndefined}, |
| {"textre_depthmultismGled_2d", BuiltinType::kUndefined}, |
| {"texture_deptN_mul4iampved_2xx", BuiltinType::kUndefined}, |
| {"texturppexAA0eral", BuiltinType::kUndefined}, |
| {"eyetyre_externl", BuiltinType::kUndefined}, |
| {"texture_eWWbern0l", BuiltinType::kUndefined}, |
| {"texturemmulttisampleMM_2d", BuiltinType::kUndefined}, |
| {"textur_multiapded_2d", BuiltinType::kUndefined}, |
| {"textuvemultisampl_d_2d", BuiltinType::kUndefined}, |
| {"tVxture_stoEEage_1d", BuiltinType::kUndefined}, |
| {"texture_stora4e_1d", BuiltinType::kUndefined}, |
| {"textuge_storaVVeX1d", BuiltinType::kUndefined}, |
| {"texturo_stVrage_2d", BuiltinType::kUndefined}, |
| {"texture_stoage_2d", BuiltinType::kUndefined}, |
| {"textKKretstrage_2d", BuiltinType::kUndefined}, |
| {"Gextur_storage_2d_ray", BuiltinType::kUndefined}, |
| {"exture_atorage_2d_array", BuiltinType::kUndefined}, |
| {"textNre_storage2dOOarry", BuiltinType::kUndefined}, |
| {"tGure_storage_3", BuiltinType::kUndefined}, |
| {"textur5_storage_3d", BuiltinType::kUndefined}, |
| {"ffexture_storaje_99d", BuiltinType::kUndefined}, |
| {"YYvXR", BuiltinType::kUndefined}, |
| {"2", BuiltinType::kUndefined}, |
| {"XX5", BuiltinType::kUndefined}, |
| {"", BuiltinType::kUndefined}, |
| {"cpp", BuiltinType::kUndefined}, |
| {"uv", BuiltinType::kUndefined}, |
| {"vEES2", BuiltinType::kUndefined}, |
| {"v2", BuiltinType::kUndefined}, |
| {"a", BuiltinType::kUndefined}, |
| {"ec2ww", BuiltinType::kUndefined}, |
| {"vecd99f", BuiltinType::kUndefined}, |
| {"ve99P", BuiltinType::kUndefined}, |
| {"KKec2", BuiltinType::kUndefined}, |
| {"ooMcDD", BuiltinType::kUndefined}, |
| {"vei", BuiltinType::kUndefined}, |
| {"vqi", BuiltinType::kUndefined}, |
| {"veL20", BuiltinType::kUndefined}, |
| {"vncvv66", BuiltinType::kUndefined}, |
| {"vrrn2", BuiltinType::kUndefined}, |
| {"vxxce", BuiltinType::kUndefined}, |
| {"NCCOc2u", BuiltinType::kUndefined}, |
| {"vc3", BuiltinType::kUndefined}, |
| {"veca", BuiltinType::kUndefined}, |
| {"veNNN", BuiltinType::kUndefined}, |
| {"ve3f", BuiltinType::kUndefined}, |
| {"veu", BuiltinType::kUndefined}, |
| {"vSYc3E", BuiltinType::kUndefined}, |
| {"vec0h", BuiltinType::kUndefined}, |
| {"vecaah", BuiltinType::kUndefined}, |
| {"vmm3h", BuiltinType::kUndefined}, |
| {"ec3i", BuiltinType::kUndefined}, |
| {"vE3U", BuiltinType::kUndefined}, |
| {"veKD3", BuiltinType::kUndefined}, |
| {"v0t3__", BuiltinType::kUndefined}, |
| {"cpA", BuiltinType::kUndefined}, |
| {"ec3u", BuiltinType::kUndefined}, |
| {"BBec4", BuiltinType::kUndefined}, |
| {"99nbb", BuiltinType::kUndefined}, |
| {"AAEe1", BuiltinType::kUndefined}, |
| {"v5c66f", BuiltinType::kUndefined}, |
| {"vHc4f", BuiltinType::kUndefined}, |
| {"vecxf", BuiltinType::kUndefined}, |
| {"vzyn40", BuiltinType::kUndefined}, |
| {"ve4h", BuiltinType::kUndefined}, |
| {"kH4h", BuiltinType::kUndefined}, |
| {"veci", BuiltinType::kUndefined}, |
| {"oo4rr", BuiltinType::kUndefined}, |
| {"JJc4", BuiltinType::kUndefined}, |
| {"vcCC0", BuiltinType::kUndefined}, |
| {"xAA99F", BuiltinType::kUndefined}, |
| {"veccu", BuiltinType::kUndefined}, |
| }; |
| |
| using BuiltinTypeParseTest = testing::TestWithParam<BuiltinTypeCase>; |
| |
| TEST_P(BuiltinTypeParseTest, Parse) { |
| const char* string = GetParam().string; |
| BuiltinType expect = GetParam().value; |
| EXPECT_EQ(expect, ParseBuiltinType(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidBuiltinTypeCases, |
| BuiltinTypeParseTest, |
| testing::ValuesIn(kValidBuiltinTypeCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidBuiltinTypeCases, |
| BuiltinTypeParseTest, |
| testing::ValuesIn(kInvalidBuiltinTypeCases)); |
| |
| using BuiltinTypePrintTest = testing::TestWithParam<BuiltinTypeCase>; |
| |
| TEST_P(BuiltinTypePrintTest, Print) { |
| BuiltinType value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidBuiltinTypeCases, |
| BuiltinTypePrintTest, |
| testing::ValuesIn(kValidBuiltinTypeCases)); |
| |
| } // namespace parse_print_tests |
| |
| namespace parse_print_tests { |
| |
| struct BuiltinValueCase { |
| const char* string; |
| BuiltinValue value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, BuiltinValueCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr BuiltinValueCase kValidBuiltinValueCases[] = { |
| {"clip_distances", BuiltinValue::kClipDistances}, |
| {"frag_depth", BuiltinValue::kFragDepth}, |
| {"front_facing", BuiltinValue::kFrontFacing}, |
| {"global_invocation_id", BuiltinValue::kGlobalInvocationId}, |
| {"instance_index", BuiltinValue::kInstanceIndex}, |
| {"local_invocation_id", BuiltinValue::kLocalInvocationId}, |
| {"local_invocation_index", BuiltinValue::kLocalInvocationIndex}, |
| {"num_workgroups", BuiltinValue::kNumWorkgroups}, |
| {"position", BuiltinValue::kPosition}, |
| {"sample_index", BuiltinValue::kSampleIndex}, |
| {"sample_mask", BuiltinValue::kSampleMask}, |
| {"subgroup_id", BuiltinValue::kSubgroupId}, |
| {"subgroup_invocation_id", BuiltinValue::kSubgroupInvocationId}, |
| {"subgroup_size", BuiltinValue::kSubgroupSize}, |
| {"vertex_index", BuiltinValue::kVertexIndex}, |
| {"workgroup_id", BuiltinValue::kWorkgroupId}, |
| }; |
| |
| static constexpr BuiltinValueCase kInvalidBuiltinValueCases[] = { |
| {"clipSdistances", BuiltinValue::kUndefined}, |
| {"clio_distsneBB", BuiltinValue::kUndefined}, |
| {"clip_distaces", BuiltinValue::kUndefined}, |
| {"frag_deemm", BuiltinValue::kUndefined}, |
| {"frgPP_deptQQ", BuiltinValue::kUndefined}, |
| {"fr_Bpt", BuiltinValue::kUndefined}, |
| {"frNKnt_cillg", BuiltinValue::kUndefined}, |
| {"fot_facrrng", BuiltinValue::kUndefined}, |
| {"ront_frcippg", BuiltinValue::kUndefined}, |
| {"global_invPPcation_yd", BuiltinValue::kUndefined}, |
| {"glccbal_ivocatioZZid", BuiltinValue::kUndefined}, |
| {"globalinvocation_i", BuiltinValue::kUndefined}, |
| {"instance_00ndex", BuiltinValue::kUndefined}, |
| {"insstanBe_iPPdex", BuiltinValue::kUndefined}, |
| {"fnfftaJJcww_ndex", BuiltinValue::kUndefined}, |
| {"loXXl_invoIation1id", BuiltinValue::kUndefined}, |
| {"oca_nvoatio_id", BuiltinValue::kUndefined}, |
| {"local_nvocation_id", BuiltinValue::kUndefined}, |
| {"local_invoction_KKndeu", BuiltinValue::kUndefined}, |
| {"local_nv44camion_index", BuiltinValue::kUndefined}, |
| {"looal_pnvocation_index", BuiltinValue::kUndefined}, |
| {"jum_wrkgroHHNphh", BuiltinValue::kUndefined}, |
| {"nwwmEUworkgr33ups", BuiltinValue::kUndefined}, |
| {"num_wuurkgrop", BuiltinValue::kUndefined}, |
| {"ociddrKon", BuiltinValue::kUndefined}, |
| {"ptti2rPPn", BuiltinValue::kUndefined}, |
| {"p1sitwwon", BuiltinValue::kUndefined}, |
| {"nncm11le_index", BuiltinValue::kUndefined}, |
| {"smple_index", BuiltinValue::kUndefined}, |
| {"sample_indx", BuiltinValue::kUndefined}, |
| {"6aamIle_mSSsk", BuiltinValue::kUndefined}, |
| {"sEEDplemask", BuiltinValue::kUndefined}, |
| {"VamplRccIask", BuiltinValue::kUndefined}, |
| {"subg9p_id", BuiltinValue::kUndefined}, |
| {"saagrohp_id", BuiltinValue::kUndefined}, |
| {"LLubgruS_id", BuiltinValue::kUndefined}, |
| {"subrouf_inrcmmtion_id", BuiltinValue::kUndefined}, |
| {"qubg4oupVinmocatin_id", BuiltinValue::kUndefined}, |
| {"subgrop_inv__cationid", BuiltinValue::kUndefined}, |
| {"suQroupsize", BuiltinValue::kUndefined}, |
| {"EbgroupddRRize", BuiltinValue::kUndefined}, |
| {"sugroup9size", BuiltinValue::kUndefined}, |
| {"vCCr0_idex", BuiltinValue::kUndefined}, |
| {"vertzx_nde", BuiltinValue::kUndefined}, |
| {"verccex_index", BuiltinValue::kUndefined}, |
| {"orkg_oOp_iQQ", BuiltinValue::kUndefined}, |
| {"workrouttid", BuiltinValue::kUndefined}, |
| {"wppECCgr33upzzid", BuiltinValue::kUndefined}, |
| }; |
| |
| using BuiltinValueParseTest = testing::TestWithParam<BuiltinValueCase>; |
| |
| TEST_P(BuiltinValueParseTest, Parse) { |
| const char* string = GetParam().string; |
| BuiltinValue expect = GetParam().value; |
| EXPECT_EQ(expect, ParseBuiltinValue(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidBuiltinValueCases, |
| BuiltinValueParseTest, |
| testing::ValuesIn(kValidBuiltinValueCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidBuiltinValueCases, |
| BuiltinValueParseTest, |
| testing::ValuesIn(kInvalidBuiltinValueCases)); |
| |
| using BuiltinValuePrintTest = testing::TestWithParam<BuiltinValueCase>; |
| |
| TEST_P(BuiltinValuePrintTest, Print) { |
| BuiltinValue value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidBuiltinValueCases, |
| BuiltinValuePrintTest, |
| testing::ValuesIn(kValidBuiltinValueCases)); |
| |
| } // namespace parse_print_tests |
| |
| namespace parse_print_tests { |
| |
| struct AttributeCase { |
| const char* string; |
| Attribute value; |
| }; |
| |
| inline std::ostream& operator<<(std::ostream& out, AttributeCase c) { |
| return out << "'" << std::string(c.string) << "'"; |
| } |
| |
| static constexpr AttributeCase kValidAttributeCases[] = { |
| {"align", Attribute::kAlign}, |
| {"binding", Attribute::kBinding}, |
| {"blend_src", Attribute::kBlendSrc}, |
| {"builtin", Attribute::kBuiltin}, |
| {"color", Attribute::kColor}, |
| {"compute", Attribute::kCompute}, |
| {"diagnostic", Attribute::kDiagnostic}, |
| {"fragment", Attribute::kFragment}, |
| {"group", Attribute::kGroup}, |
| {"id", Attribute::kId}, |
| {"input_attachment_index", Attribute::kInputAttachmentIndex}, |
| {"interpolate", Attribute::kInterpolate}, |
| {"invariant", Attribute::kInvariant}, |
| {"location", Attribute::kLocation}, |
| {"must_use", Attribute::kMustUse}, |
| {"size", Attribute::kSize}, |
| {"vertex", Attribute::kVertex}, |
| {"workgroup_size", Attribute::kWorkgroupSize}, |
| }; |
| |
| static constexpr AttributeCase kInvalidAttributeCases[] = { |
| {"alddhhn", Attribute::kUndefined}, |
| {"l7766n", Attribute::kUndefined}, |
| {"aligP", Attribute::kUndefined}, |
| {"binwing", Attribute::kUndefined}, |
| {"uuing", Attribute::kUndefined}, |
| {"6indXXng", Attribute::kUndefined}, |
| {"lend_RR", Attribute::kUndefined}, |
| {"lVV_src", Attribute::kUndefined}, |
| {"bleHHGd_src", Attribute::kUndefined}, |
| {"bMiFF7in", Attribute::kUndefined}, |
| {"builti", Attribute::kUndefined}, |
| {"uiltgg", Attribute::kUndefined}, |
| {"KK1l_Q", Attribute::kUndefined}, |
| {"cElo", Attribute::kUndefined}, |
| {"loM", Attribute::kUndefined}, |
| {"coG77SpuX", Attribute::kUndefined}, |
| {"FFttpuKe", Attribute::kUndefined}, |
| {"cZZmpUsste", Attribute::kUndefined}, |
| {"dagnostic", Attribute::kUndefined}, |
| {"liagnostic", Attribute::kUndefined}, |
| {"dihgnostic", Attribute::kUndefined}, |
| {"fraTTKkt", Attribute::kUndefined}, |
| {"frgwwene", Attribute::kUndefined}, |
| {"jjKagmevv", Attribute::kUndefined}, |
| {"Yrup", Attribute::kUndefined}, |
| {"ErIIp", Attribute::kUndefined}, |
| {"gQQoup", Attribute::kUndefined}, |
| {"B", Attribute::kUndefined}, |
| {"iukk", Attribute::kUndefined}, |
| {"F66", Attribute::kUndefined}, |
| {"input_athsa8hment_index", Attribute::kUndefined}, |
| {"FFnput_attachment_inlle", Attribute::kUndefined}, |
| {"in2ut_atacjjment_index", Attribute::kUndefined}, |
| {"ingerpolate", Attribute::kUndefined}, |
| {"intereolat", Attribute::kUndefined}, |
| {"interplaffe", Attribute::kUndefined}, |
| {"nvarit", Attribute::kUndefined}, |
| {"nvariant", Attribute::kUndefined}, |
| {"inariaqqt", Attribute::kUndefined}, |
| {"lotoAA", Attribute::kUndefined}, |
| {"vocatio", Attribute::kUndefined}, |
| {"locajjon", Attribute::kUndefined}, |
| {"ZZust_use", Attribute::kUndefined}, |
| {"mO2PP_uIIe", Attribute::kUndefined}, |
| {"muZZt_use", Attribute::kUndefined}, |
| {"snnze", Attribute::kUndefined}, |
| {"ZZHkk2e", Attribute::kUndefined}, |
| {"siz", Attribute::kUndefined}, |
| {"Rrtx", Attribute::kUndefined}, |
| {"veqqte99", Attribute::kUndefined}, |
| {"v77rtex", Attribute::kUndefined}, |
| {"wokgoup_si3e", Attribute::kUndefined}, |
| {"wokccrouuu_size", Attribute::kUndefined}, |
| {"wor1groupRRize", Attribute::kUndefined}, |
| }; |
| |
| using AttributeParseTest = testing::TestWithParam<AttributeCase>; |
| |
| TEST_P(AttributeParseTest, Parse) { |
| const char* string = GetParam().string; |
| Attribute expect = GetParam().value; |
| EXPECT_EQ(expect, ParseAttribute(string)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidAttributeCases, |
| AttributeParseTest, |
| testing::ValuesIn(kValidAttributeCases)); |
| INSTANTIATE_TEST_SUITE_P(InvalidAttributeCases, |
| AttributeParseTest, |
| testing::ValuesIn(kInvalidAttributeCases)); |
| |
| using AttributePrintTest = testing::TestWithParam<AttributeCase>; |
| |
| TEST_P(AttributePrintTest, Print) { |
| Attribute value = GetParam().value; |
| const char* expect = GetParam().string; |
| EXPECT_EQ(expect, ToString(value)); |
| } |
| |
| INSTANTIATE_TEST_SUITE_P(ValidAttributeCases, |
| AttributePrintTest, |
| testing::ValuesIn(kValidAttributeCases)); |
| |
| } // namespace parse_print_tests |
| |
| } // namespace |
| } // namespace tint::core |