| // 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}, {"r16float", TexelFormat::kR16Float}, |
| {"r16sint", TexelFormat::kR16Sint}, {"r16snorm", TexelFormat::kR16Snorm}, |
| {"r16uint", TexelFormat::kR16Uint}, {"r16unorm", TexelFormat::kR16Unorm}, |
| {"r32float", TexelFormat::kR32Float}, {"r32sint", TexelFormat::kR32Sint}, |
| {"r32uint", TexelFormat::kR32Uint}, {"r8sint", TexelFormat::kR8Sint}, |
| {"r8snorm", TexelFormat::kR8Snorm}, {"r8uint", TexelFormat::kR8Uint}, |
| {"r8unorm", TexelFormat::kR8Unorm}, {"rg11b10ufloat", TexelFormat::kRg11B10Ufloat}, |
| {"rg16float", TexelFormat::kRg16Float}, {"rg16sint", TexelFormat::kRg16Sint}, |
| {"rg16snorm", TexelFormat::kRg16Snorm}, {"rg16uint", TexelFormat::kRg16Uint}, |
| {"rg16unorm", TexelFormat::kRg16Unorm}, {"rg32float", TexelFormat::kRg32Float}, |
| {"rg32sint", TexelFormat::kRg32Sint}, {"rg32uint", TexelFormat::kRg32Uint}, |
| {"rg8sint", TexelFormat::kRg8Sint}, {"rg8snorm", TexelFormat::kRg8Snorm}, |
| {"rg8uint", TexelFormat::kRg8Uint}, {"rg8unorm", TexelFormat::kRg8Unorm}, |
| {"rgb10a2uint", TexelFormat::kRgb10A2Uint}, {"rgb10a2unorm", TexelFormat::kRgb10A2Unorm}, |
| {"rgba16float", TexelFormat::kRgba16Float}, {"rgba16sint", TexelFormat::kRgba16Sint}, |
| {"rgba16snorm", TexelFormat::kRgba16Snorm}, {"rgba16uint", TexelFormat::kRgba16Uint}, |
| {"rgba16unorm", TexelFormat::kRgba16Unorm}, {"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}, {"r16fcoat", TexelFormat::kUndefined}, |
| {"r16floOt", TexelFormat::kUndefined}, {"r16floKK_vtt", TexelFormat::kUndefined}, |
| {"xx8sint", TexelFormat::kUndefined}, {"__q16Fn", TexelFormat::kUndefined}, |
| {"r16qint", TexelFormat::kUndefined}, {"r1633nor6", TexelFormat::kUndefined}, |
| {"rtto6sn9QQm", TexelFormat::kUndefined}, {"r1666nor", TexelFormat::kUndefined}, |
| {"r6Oizz66", TexelFormat::kUndefined}, {"r16uyynt", TexelFormat::kUndefined}, |
| {"Z1HHnZ", TexelFormat::kUndefined}, {"qWW46unrm", TexelFormat::kUndefined}, |
| {"r16OOnrm", TexelFormat::kUndefined}, {"16unoYm", TexelFormat::kUndefined}, |
| {"rloat", TexelFormat::kUndefined}, {"r3fFoat", TexelFormat::kUndefined}, |
| {"w32floa", TexelFormat::kUndefined}, {"fG2iKt", TexelFormat::kUndefined}, |
| {"r32qKint", TexelFormat::kUndefined}, {"r32mmiFt", TexelFormat::kUndefined}, |
| {"32uint", TexelFormat::kUndefined}, {"r2uinq", TexelFormat::kUndefined}, |
| {"r32uibb", TexelFormat::kUndefined}, {"isint", TexelFormat::kUndefined}, |
| {"rOOinq", TexelFormat::kUndefined}, {"r8siTvvt", TexelFormat::kUndefined}, |
| {"r8FFnorm", TexelFormat::kUndefined}, {"P800oQm", TexelFormat::kUndefined}, |
| {"rPsnorm", TexelFormat::kUndefined}, {"rssin77", TexelFormat::kUndefined}, |
| {"r8CiRRbb", TexelFormat::kUndefined}, {"r8uinXX", TexelFormat::kUndefined}, |
| {"q8CCnoOOm", TexelFormat::kUndefined}, {"r8nsrL", TexelFormat::kUndefined}, |
| {"rXunorm", TexelFormat::kUndefined}, {"r11b10ufloat", TexelFormat::kUndefined}, |
| {"g11b10ufqqo", TexelFormat::kUndefined}, {"rg122b10ufloat", TexelFormat::kUndefined}, |
| {"rzzy6Xlo0t", TexelFormat::kUndefined}, {"rP1ifloat", TexelFormat::kUndefined}, |
| {"rg6Cnnoat", TexelFormat::kUndefined}, {"rgqqAAHHn", TexelFormat::kUndefined}, |
| {"g16sint", TexelFormat::kUndefined}, {"rg1fKin", TexelFormat::kUndefined}, |
| {"lgg16snP", TexelFormat::kUndefined}, {"rg6snorm", TexelFormat::kUndefined}, |
| {"4g16cTNorm", TexelFormat::kUndefined}, {"pgl6uin77", TexelFormat::kUndefined}, |
| {"rz1Ngint", TexelFormat::kUndefined}, {"bg16uXXut", TexelFormat::kUndefined}, |
| {"rg16norm", TexelFormat::kUndefined}, {"Q688norK", TexelFormat::kUndefined}, |
| {"rg9unqrm", TexelFormat::kUndefined}, {"rg32flo11t", TexelFormat::kUndefined}, |
| {"rgiiF22oat", TexelFormat::kUndefined}, {"r773float", TexelFormat::kUndefined}, |
| {"rg3NNi2t", TexelFormat::kUndefined}, {"rg32VVint", TexelFormat::kUndefined}, |
| {"WW1132swnF", TexelFormat::kUndefined}, {"rww32uin", TexelFormat::kUndefined}, |
| {"rg32uiDt", TexelFormat::kUndefined}, {"rg32inK", TexelFormat::kUndefined}, |
| {"rg8s1PPht", TexelFormat::kUndefined}, {"rg8snt", TexelFormat::kUndefined}, |
| {"rYY8sint", TexelFormat::kUndefined}, {"kkHHsnVtm", TexelFormat::kUndefined}, |
| {"rg8rrnorm", TexelFormat::kUndefined}, {"rs8snorWW", TexelFormat::kUndefined}, |
| {"Y8uint", TexelFormat::kUndefined}, {"r8uqft", TexelFormat::kUndefined}, |
| {"rgv22uiut", TexelFormat::kUndefined}, {"rgunor", TexelFormat::kUndefined}, |
| {"Yg8norm", TexelFormat::kUndefined}, {"7YEg8unorm", TexelFormat::kUndefined}, |
| {"oog10a2dinM", TexelFormat::kUndefined}, {"rgb0a2uinMM", TexelFormat::kUndefined}, |
| {"rgb10a2uin55", TexelFormat::kUndefined}, {"rb0a2uNorm", TexelFormat::kUndefined}, |
| {"Ogb330a23nrm", TexelFormat::kUndefined}, {"rgb1032unorm", TexelFormat::kUndefined}, |
| {"rgbI6flomt", TexelFormat::kUndefined}, {"rrbK16flnnat", TexelFormat::kUndefined}, |
| {"rba1flXX", TexelFormat::kUndefined}, {"Iga1pLLint", TexelFormat::kUndefined}, |
| {"fb16sint", TexelFormat::kUndefined}, {"UgbRRDsinY", TexelFormat::kUndefined}, |
| {"rgha16snorm", TexelFormat::kUndefined}, {"rba1quunIIr", TexelFormat::kUndefined}, |
| {"rgba16Hnorm", TexelFormat::kUndefined}, {"gbaQQvvint", TexelFormat::kUndefined}, |
| {"66a16uent", TexelFormat::kUndefined}, {"rW7a16uin", TexelFormat::kUndefined}, |
| {"rg0a556unorDD", TexelFormat::kUndefined}, {"rgbH16unIIrm", TexelFormat::kUndefined}, |
| {"rba16unorm", TexelFormat::kUndefined}, {"rba32flort", TexelFormat::kUndefined}, |
| {"rlba32float", TexelFormat::kUndefined}, {"tGgb32loJJt", TexelFormat::kUndefined}, |
| {"rgya3sint", TexelFormat::kUndefined}, {"rba32sint", TexelFormat::kUndefined}, |
| {"IIgbaBB2sint", TexelFormat::kUndefined}, {"33Kb832uinTT", TexelFormat::kUndefined}, |
| {"nngbaYYUUuindSS", TexelFormat::kUndefined}, {"dgba5x2uiZt", TexelFormat::kUndefined}, |
| {"rkkba8sinq", TexelFormat::kUndefined}, {"5bapisin00", TexelFormat::kUndefined}, |
| {"rnnba8siIIt", TexelFormat::kUndefined}, {"ccWbsnoKm", TexelFormat::kUndefined}, |
| {"rgb8snKK", TexelFormat::kUndefined}, {"rgba8sno66m", TexelFormat::kUndefined}, |
| {"rgaKPPuin", TexelFormat::kUndefined}, {"rgxxa8int", TexelFormat::kUndefined}, |
| {"rgbq8uint", TexelFormat::kUndefined}, {"rMba8SSnyyrm", TexelFormat::kUndefined}, |
| {"rgbuunrm", TexelFormat::kUndefined}, {"rgbSnrm", 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}, |
| {"texel_buffer", BuiltinType::kTexelBuffer}, |
| {"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_cFFmpare_exchange_result_i52", BuiltinType::kUndefined}, |
| {"__at4zmic_compare_exchange_resurrt_i32", BuiltinType::kUndefined}, |
| {"__atWWic_ompare_exhange_result_i32", BuiltinType::kUndefined}, |
| {"__atomic_comZZare_JXxchange_result_C32", BuiltinType::kUndefined}, |
| {"PP_atomic_compare_exchange_reslt_u32", BuiltinType::kUndefined}, |
| {"__atomic_compare_exchange_resuct_u32", BuiltinType::kUndefined}, |
| {"__frexPP_resul6_abstrllct", BuiltinType::kUndefined}, |
| {"_frexp_result_yybstr99ct", BuiltinType::kUndefined}, |
| {"__frexpJresult_absKKract", BuiltinType::kUndefined}, |
| {"__frexp__xsult_f6", BuiltinType::kUndefined}, |
| {"yfKex_result_f16", BuiltinType::kUndefined}, |
| {"__frexpVresukt_f1z", BuiltinType::kUndefined}, |
| {"__fKexp_Sesuqt_f32", BuiltinType::kUndefined}, |
| {"__frexp_result_f2", BuiltinType::kUndefined}, |
| {"__rexp_result_fVV2", BuiltinType::kUndefined}, |
| {"__frexpAAreIult_veU2_abstract", BuiltinType::kUndefined}, |
| {"__jrexp_rRult_vec2_abtract", BuiltinType::kUndefined}, |
| {"_frexpres44l_vec2_abstrYYct", BuiltinType::kUndefined}, |
| {"__frexp_result_ve2_f16", BuiltinType::kUndefined}, |
| {"__frexxp_rsult_ve11_f19", BuiltinType::kUndefined}, |
| {"__frexcc_msult_vec2_f1J", BuiltinType::kUndefined}, |
| {"__frexp_reult_vec2_f3JJ", BuiltinType::kUndefined}, |
| {"__fCCUxp_result_fecDD_f32", BuiltinType::kUndefined}, |
| {"__frgxp_result_vec2_f32", BuiltinType::kUndefined}, |
| {"__frep_result_vecCC_absact", BuiltinType::kUndefined}, |
| {"__frexp_resul_vec3_abstract", BuiltinType::kUndefined}, |
| {"__fIexp_result_vec3_abstr__ct", BuiltinType::kUndefined}, |
| {"__rep_resultt_vecN_fPP6", BuiltinType::kUndefined}, |
| {"_3frexp_result_vedd3_f16", BuiltinType::kUndefined}, |
| {"__frKxp_reult_yyec3_f16", BuiltinType::kUndefined}, |
| {"__frep_rest_vuuc3_f3", BuiltinType::kUndefined}, |
| {"nn_fre0i_result_vec3_f33", BuiltinType::kUndefined}, |
| {"K_frexp_renvlt_vec3uufCC2", BuiltinType::kUndefined}, |
| {"__frllxp_Xesult_ec4_abstract", BuiltinType::kUndefined}, |
| {"__frexp_result_vec4_aostrppct", BuiltinType::kUndefined}, |
| {"ww_frexp_result_vec4_abstrat", BuiltinType::kUndefined}, |
| {"uu_fgxp_reslt_vec4mmf16", BuiltinType::kUndefined}, |
| {"aa_frexpesmmltvec4_f16", BuiltinType::kUndefined}, |
| {"__TrexRR_result_vecZ_cc16", BuiltinType::kUndefined}, |
| {"__frexp_result_vec8T_fO2", BuiltinType::kUndefined}, |
| {"__frexp_mesult00vec4_f32", BuiltinType::kUndefined}, |
| {"m_frexp_result_vBBc4_f32", BuiltinType::kUndefined}, |
| {"__mppdfresult_Mstract", BuiltinType::kUndefined}, |
| {"__modf_result_OObstact", BuiltinType::kUndefined}, |
| {"__modf_resGlGG_abstrat", BuiltinType::kUndefined}, |
| {"11_modf_reHHult_f16", BuiltinType::kUndefined}, |
| {"__FFodfresu6ee_f16", BuiltinType::kUndefined}, |
| {"__of_result_f16", BuiltinType::kUndefined}, |
| {"__miilf_resultKf32", BuiltinType::kUndefined}, |
| {"__mof_result_f32", BuiltinType::kUndefined}, |
| {"__modII_99esult_vv3", BuiltinType::kUndefined}, |
| {"__odf_result_vec2_abstract", BuiltinType::kUndefined}, |
| {"__modf_result_vec2habstract", BuiltinType::kUndefined}, |
| {"__modf_resulzllP_vec2_absract", BuiltinType::kUndefined}, |
| {"__mod_eslt_vec2f16", BuiltinType::kUndefined}, |
| {"__modf_ffesult_qqec2f16", BuiltinType::kUndefined}, |
| {"W_mdf_resuldd_veJJ2_f16", BuiltinType::kUndefined}, |
| {"__mXXdf_result_vzz_f3r", BuiltinType::kUndefined}, |
| {"__modf_result_2ec2_32", BuiltinType::kUndefined}, |
| {"__modf_rNsult_veyy2_f32", BuiltinType::kUndefined}, |
| {"__modf_rOOslt_vec3_astrct", BuiltinType::kUndefined}, |
| {"__modf_reruuZ_vec3_abEtracP", BuiltinType::kUndefined}, |
| {"__modf_elueet_vec3_abstrac2dd", BuiltinType::kUndefined}, |
| {"__modf_eslt_VVec9_f16", BuiltinType::kUndefined}, |
| {"__modf_rI1sult_vec_f16", BuiltinType::kUndefined}, |
| {"__modf_result_bec3_f16", BuiltinType::kUndefined}, |
| {"i_mf_result_vec3z732", BuiltinType::kUndefined}, |
| {"ii_modf_result_oec3_f32", BuiltinType::kUndefined}, |
| {"__mdf_resul_v5c3nf32", BuiltinType::kUndefined}, |
| {"__modf_resuliSvec4abstract", BuiltinType::kUndefined}, |
| {"_modf_result_vec4_22btract", BuiltinType::kUndefined}, |
| {"_117odf_Cesult_vec_abstraGt", BuiltinType::kUndefined}, |
| {"__modf_result_vffc48f16", BuiltinType::kUndefined}, |
| {"__mdf_rsult_vec4_f16", BuiltinType::kUndefined}, |
| {"_JJSSodf_result_vec4_f16", BuiltinType::kUndefined}, |
| {"__odf_re9ul_vec4_f32", BuiltinType::kUndefined}, |
| {"__modf_bbesJJlt_vec4_fTT2", BuiltinType::kUndefined}, |
| {"__mdf66reult_vec4_f32", BuiltinType::kUndefined}, |
| {"u66ay", BuiltinType::kUndefined}, |
| {"aWay", BuiltinType::kUndefined}, |
| {"aay", BuiltinType::kUndefined}, |
| {"atmic", BuiltinType::kUndefined}, |
| {"rtomic", BuiltinType::kUndefined}, |
| {"a2omiB", BuiltinType::kUndefined}, |
| {"bindng_arrBBy", BuiltinType::kUndefined}, |
| {"RRnding_array", BuiltinType::kUndefined}, |
| {"VVnding_a0LLy", BuiltinType::kUndefined}, |
| {"KOol", BuiltinType::kUndefined}, |
| {"gwol", BuiltinType::kUndefined}, |
| {"hpLo", BuiltinType::kUndefined}, |
| {"ii6", BuiltinType::kUndefined}, |
| {"16", BuiltinType::kUndefined}, |
| {"88U", BuiltinType::kUndefined}, |
| {"rrvv2", BuiltinType::kUndefined}, |
| {"wm", BuiltinType::kUndefined}, |
| {"fj4", BuiltinType::kUndefined}, |
| {"X32", BuiltinType::kUndefined}, |
| {"i82", BuiltinType::kUndefined}, |
| {"ivEE", BuiltinType::kUndefined}, |
| {"iz", BuiltinType::kUndefined}, |
| {"GGJJ8", BuiltinType::kUndefined}, |
| {"ss8", BuiltinType::kUndefined}, |
| {"Pnput_aKtachment", BuiltinType::kUndefined}, |
| {"input_atppchttnt", BuiltinType::kUndefined}, |
| {"input_aachment", BuiltinType::kUndefined}, |
| {"maMM2x2", BuiltinType::kUndefined}, |
| {"mJ0t2x2", BuiltinType::kUndefined}, |
| {"V28", BuiltinType::kUndefined}, |
| {"maKggx2hh", BuiltinType::kUndefined}, |
| {"maf2x2f", BuiltinType::kUndefined}, |
| {"matQ7x2f", BuiltinType::kUndefined}, |
| {"mat2YYh", BuiltinType::kUndefined}, |
| {"mak2x2", BuiltinType::kUndefined}, |
| {"man2x2", BuiltinType::kUndefined}, |
| {"mFFx3", BuiltinType::kUndefined}, |
| {"GGatPPuUU", BuiltinType::kUndefined}, |
| {"mEEFa3", BuiltinType::kUndefined}, |
| {"ddtBBDDef", BuiltinType::kUndefined}, |
| {"m55tMccE3", BuiltinType::kUndefined}, |
| {"aKKx3", BuiltinType::kUndefined}, |
| {"mat2x3R", BuiltinType::kUndefined}, |
| {"maDx39", BuiltinType::kUndefined}, |
| {"mt2x3h", BuiltinType::kUndefined}, |
| {"aIt24", BuiltinType::kUndefined}, |
| {"mat2x77", BuiltinType::kUndefined}, |
| {"matIx4", BuiltinType::kUndefined}, |
| {"md2x4f", BuiltinType::kUndefined}, |
| {"mat24f", BuiltinType::kUndefined}, |
| {"mtt4f", BuiltinType::kUndefined}, |
| {"ma3XX2x4h", BuiltinType::kUndefined}, |
| {"Eat24h", BuiltinType::kUndefined}, |
| {"maXX2x4", BuiltinType::kUndefined}, |
| {"mxBt3x2", BuiltinType::kUndefined}, |
| {"Wt3x", BuiltinType::kUndefined}, |
| {"mat66x2", BuiltinType::kUndefined}, |
| {"matxv0", BuiltinType::kUndefined}, |
| {"txf", BuiltinType::kUndefined}, |
| {"mpt3xf", BuiltinType::kUndefined}, |
| {"at112h", BuiltinType::kUndefined}, |
| {"EaJ3yBBh", BuiltinType::kUndefined}, |
| {"mqIm3x2h", BuiltinType::kUndefined}, |
| {"ma3F3", BuiltinType::kUndefined}, |
| {"aY3x3", BuiltinType::kUndefined}, |
| {"matDHh3", BuiltinType::kUndefined}, |
| {"Ht22f", BuiltinType::kUndefined}, |
| {"matx3", BuiltinType::kUndefined}, |
| {"matx3f", BuiltinType::kUndefined}, |
| {"matx3h", BuiltinType::kUndefined}, |
| {"matddx3h", BuiltinType::kUndefined}, |
| {"Oat3x3h", BuiltinType::kUndefined}, |
| {"bbtB4", BuiltinType::kUndefined}, |
| {"m00tx4", BuiltinType::kUndefined}, |
| {"hat3x4", BuiltinType::kUndefined}, |
| {"mgYtx4f", BuiltinType::kUndefined}, |
| {"mat3O4f", BuiltinType::kUndefined}, |
| {"ah3xf", BuiltinType::kUndefined}, |
| {"fpaEEx4h", BuiltinType::kUndefined}, |
| {"mavx4h", BuiltinType::kUndefined}, |
| {"mzztx4h", BuiltinType::kUndefined}, |
| {"mat4x", BuiltinType::kUndefined}, |
| {"OiiJt4", BuiltinType::kUndefined}, |
| {"mGt4xf", BuiltinType::kUndefined}, |
| {"mat4x222T", BuiltinType::kUndefined}, |
| {"datlx2f", BuiltinType::kUndefined}, |
| {"bat4x2f", BuiltinType::kUndefined}, |
| {"BBatx2h", BuiltinType::kUndefined}, |
| {"PPIXt4S2h", BuiltinType::kUndefined}, |
| {"mjjt4x2h", BuiltinType::kUndefined}, |
| {"macc4_3", BuiltinType::kUndefined}, |
| {"SS6zz4xx", BuiltinType::kUndefined}, |
| {"mtx", BuiltinType::kUndefined}, |
| {"mx44N3v", BuiltinType::kUndefined}, |
| {"atAAx00p", BuiltinType::kUndefined}, |
| {"eeytyf", BuiltinType::kUndefined}, |
| {"mabWWx0h", BuiltinType::kUndefined}, |
| {"ttatMMxmh", BuiltinType::kUndefined}, |
| {"madh", BuiltinType::kUndefined}, |
| {"mav_x", BuiltinType::kUndefined}, |
| {"mVt4xEE", BuiltinType::kUndefined}, |
| {"m4t4x4", BuiltinType::kUndefined}, |
| {"VVag4x4X", BuiltinType::kUndefined}, |
| {"maV4o4f", BuiltinType::kUndefined}, |
| {"ma4x4f", BuiltinType::kUndefined}, |
| {"KKattxh", BuiltinType::kUndefined}, |
| {"G4xh", BuiltinType::kUndefined}, |
| {"ma4x4", BuiltinType::kUndefined}, |
| {"ptd", BuiltinType::kUndefined}, |
| {"pCPtd", BuiltinType::kUndefined}, |
| {"p", BuiltinType::kUndefined}, |
| {"s5mpler", BuiltinType::kUndefined}, |
| {"s9jmffler", BuiltinType::kUndefined}, |
| {"samRvlXXr", BuiltinType::kUndefined}, |
| {"samper_ompariscn", BuiltinType::kUndefined}, |
| {"sampler_copaXXi58n", BuiltinType::kUndefined}, |
| {"samplr_comprison", BuiltinType::kUndefined}, |
| {"subgrppp_matrix_lecct", BuiltinType::kUndefined}, |
| {"subgroup_matrvx_left", BuiltinType::kUndefined}, |
| {"sEEbgrupJmatSSix_left", BuiltinType::kUndefined}, |
| {"subgrup_marix_result", BuiltinType::kUndefined}, |
| {"sbgrup_m_trix_resut", BuiltinType::kUndefined}, |
| {"sbgroup_m_trix_rewwult", BuiltinType::kUndefined}, |
| {"subgroup_matrix_ri99ddt", BuiltinType::kUndefined}, |
| {"subgroPP_m99trix_righ", BuiltinType::kUndefined}, |
| {"sugroup_matrix_rKKght", BuiltinType::kUndefined}, |
| {"teel_buoofeDD", BuiltinType::kUndefined}, |
| {"exel_uBeii", BuiltinType::kUndefined}, |
| {"texl_buqer", BuiltinType::kUndefined}, |
| {"txt00rLL_d", BuiltinType::kUndefined}, |
| {"tnxture_16vv", BuiltinType::kUndefined}, |
| {"trrxtur_nd", BuiltinType::kUndefined}, |
| {"xxture_eed", BuiltinType::kUndefined}, |
| {"CCNOxture_2d", BuiltinType::kUndefined}, |
| {"txture_2d", BuiltinType::kUndefined}, |
| {"tex4ure_2d_array", BuiltinType::kUndefined}, |
| {"teNNture_2d_arNNy", BuiltinType::kUndefined}, |
| {"texture2d_array", BuiltinType::kUndefined}, |
| {"tuxtre3d", BuiltinType::kUndefined}, |
| {"textErYYS3A", BuiltinType::kUndefined}, |
| {"tex0ure_3d", BuiltinType::kUndefined}, |
| {"texaaure_cube", BuiltinType::kUndefined}, |
| {"extre_cubmmq", BuiltinType::kUndefined}, |
| {"texture_cbe", BuiltinType::kUndefined}, |
| {"tExtue_cube_araUU", BuiltinType::kUndefined}, |
| {"eturKK_cube_aDDray", BuiltinType::kUndefined}, |
| {"textut___cu0e_array", BuiltinType::kUndefined}, |
| {"tpturl_dpAh_2d", BuiltinType::kUndefined}, |
| {"txture_dMpth_2d", BuiltinType::kUndefined}, |
| {"BBexture_depth_2d", BuiltinType::kUndefined}, |
| {"text99e_depth2bb_arnnay", BuiltinType::kUndefined}, |
| {"EEe1tureAAdepth_2d_arra", BuiltinType::kUndefined}, |
| {"texturT_dep5h_2d_arra66", BuiltinType::kUndefined}, |
| {"textuHe_depth_cube", BuiltinType::kUndefined}, |
| {"texture_dxpthHHcbe", BuiltinType::kUndefined}, |
| {"zexture_deptyy0cubn", BuiltinType::kUndefined}, |
| {"texture_deth_cube_array", BuiltinType::kUndefined}, |
| {"texture_depth_cubeHkray", BuiltinType::kUndefined}, |
| {"texture_depth_cubearcay", BuiltinType::kUndefined}, |
| {"texture_depth_urrtiooapled_2d", BuiltinType::kUndefined}, |
| {"texue_depth_JJultisampled_2d", BuiltinType::kUndefined}, |
| {"texture_depth_multCCsampld_20", BuiltinType::kUndefined}, |
| {"99eAAure_exxernal", BuiltinType::kUndefined}, |
| {"textcre_external", BuiltinType::kUndefined}, |
| {"texture_Sxternal", BuiltinType::kUndefined}, |
| {"BBextre_multisaopleds2d", BuiltinType::kUndefined}, |
| {"texture_multisampld_2d", BuiltinType::kUndefined}, |
| {"texmmur_multieampled_2d", BuiltinType::kUndefined}, |
| {"tQQturPP_storage_1gg", BuiltinType::kUndefined}, |
| {"textr_stoBe_1d", BuiltinType::kUndefined}, |
| {"tlKKtur_storagN_1d", BuiltinType::kUndefined}, |
| {"trrture_storage2d", BuiltinType::kUndefined}, |
| {"texrure_tpprage_2d", BuiltinType::kUndefined}, |
| {"teyture_storage_PPd", BuiltinType::kUndefined}, |
| {"texturcc_torageZ2d_array", BuiltinType::kUndefined}, |
| {"texturestorage_2d_aray", BuiltinType::kUndefined}, |
| {"texture_storage_2d_00rray", BuiltinType::kUndefined}, |
| {"texPPuBB_stJrage_ssd", BuiltinType::kUndefined}, |
| {"texJJre_sffowwagf_3d", BuiltinType::kUndefined}, |
| {"textIre_stoXXage_3", BuiltinType::kUndefined}, |
| {"a", BuiltinType::kUndefined}, |
| {"u3", BuiltinType::kUndefined}, |
| {"KK2", BuiltinType::kUndefined}, |
| {"m4", BuiltinType::kUndefined}, |
| {"o8", BuiltinType::kUndefined}, |
| {"jNHh", BuiltinType::kUndefined}, |
| {"vEw3Uc2", BuiltinType::kUndefined}, |
| {"vuc", BuiltinType::kUndefined}, |
| {"Krrdd", BuiltinType::kUndefined}, |
| {"2Pttcf", BuiltinType::kUndefined}, |
| {"vwwcsf", BuiltinType::kUndefined}, |
| {"11enncf", BuiltinType::kUndefined}, |
| {"ve2h", BuiltinType::kUndefined}, |
| {"vech", BuiltinType::kUndefined}, |
| {"ecaSSIh", BuiltinType::kUndefined}, |
| {"vED2i", BuiltinType::kUndefined}, |
| {"veIccR", BuiltinType::kUndefined}, |
| {"ec9", BuiltinType::kUndefined}, |
| {"aec2u", BuiltinType::kUndefined}, |
| {"LSc2u", BuiltinType::kUndefined}, |
| {"ecmm", BuiltinType::kUndefined}, |
| {"4eV", BuiltinType::kUndefined}, |
| {"ec_", BuiltinType::kUndefined}, |
| {"cQ", BuiltinType::kUndefined}, |
| {"veERdd", BuiltinType::kUndefined}, |
| {"vec9", BuiltinType::kUndefined}, |
| {"e03", BuiltinType::kUndefined}, |
| {"vzh", BuiltinType::kUndefined}, |
| {"veccch", BuiltinType::kUndefined}, |
| {"v_Qch", BuiltinType::kUndefined}, |
| {"vect", BuiltinType::kUndefined}, |
| {"zz3ecECpp", BuiltinType::kUndefined}, |
| {"veddhhi", BuiltinType::kUndefined}, |
| {"e7766u", BuiltinType::kUndefined}, |
| {"vec3P", BuiltinType::kUndefined}, |
| {"vecwu", BuiltinType::kUndefined}, |
| {"vu", BuiltinType::kUndefined}, |
| {"6ecXX", BuiltinType::kUndefined}, |
| {"RR", BuiltinType::kUndefined}, |
| {"e1V", BuiltinType::kUndefined}, |
| {"vecHHGG", BuiltinType::kUndefined}, |
| {"MeFF4f", BuiltinType::kUndefined}, |
| {"ve4h", BuiltinType::kUndefined}, |
| {"cTgg", BuiltinType::kUndefined}, |
| {"KK1c_Q", BuiltinType::kUndefined}, |
| {"vEc4", BuiltinType::kUndefined}, |
| {"c4M", BuiltinType::kUndefined}, |
| {"veS77G4", BuiltinType::kUndefined}, |
| {"vKFttu", BuiltinType::kUndefined}, |
| {"vZZUss4u", BuiltinType::kUndefined}, |
| {"vc4u", 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}, |
| {"primitive_id", BuiltinValue::kPrimitiveId}, |
| {"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[] = { |
| {"clip_dlstances", BuiltinValue::kUndefined}, |
| {"clip_dishances", BuiltinValue::kUndefined}, |
| {"Klip_dktancTTs", BuiltinValue::kUndefined}, |
| {"fae_depwwh", BuiltinValue::kUndefined}, |
| {"fjaKvvdepth", BuiltinValue::kUndefined}, |
| {"fragYdeth", BuiltinValue::kUndefined}, |
| {"EEIont_fcing", BuiltinValue::kUndefined}, |
| {"front_facinQQ", BuiltinValue::kUndefined}, |
| {"fronP_fanl", BuiltinValue::kUndefined}, |
| {"globalffinvocatin_iHH", BuiltinValue::kUndefined}, |
| {"global_innocation_id", BuiltinValue::kUndefined}, |
| {"g66obag_invoFatio_id", BuiltinValue::kUndefined}, |
| {"inss8ancehindex", BuiltinValue::kUndefined}, |
| {"llnstaFFce_ndex", BuiltinValue::kUndefined}, |
| {"2sjjace00index", BuiltinValue::kUndefined}, |
| {"local_gnvocation_id", BuiltinValue::kUndefined}, |
| {"localeinvocation_d", BuiltinValue::kUndefined}, |
| {"local_invocatioff_d", BuiltinValue::kUndefined}, |
| {"locinvocation_index", BuiltinValue::kUndefined}, |
| {"local_invocation_inde", BuiltinValue::kUndefined}, |
| {"local_qqnvcation_index", BuiltinValue::kUndefined}, |
| {"nu_workgrpAA", BuiltinValue::kUndefined}, |
| {"numwovkgroups", BuiltinValue::kUndefined}, |
| {"njjm_workgrous", BuiltinValue::kUndefined}, |
| {"ZZosition", BuiltinValue::kUndefined}, |
| {"pO2PPtiIIn", BuiltinValue::kUndefined}, |
| {"poZZition", BuiltinValue::kUndefined}, |
| {"priminnive_id", BuiltinValue::kUndefined}, |
| {"primHtivZkk_22d", BuiltinValue::kUndefined}, |
| {"primitie_id", BuiltinValue::kUndefined}, |
| {"sampR_inex", BuiltinValue::kUndefined}, |
| {"sampl99_iqqdex", BuiltinValue::kUndefined}, |
| {"s77mple_index", BuiltinValue::kUndefined}, |
| {"s3mpemask", BuiltinValue::kUndefined}, |
| {"sampluu_mcck", BuiltinValue::kUndefined}, |
| {"s1mplRR_mas", BuiltinValue::kUndefined}, |
| {"subgrllp_JJd", BuiltinValue::kUndefined}, |
| {"sbgrMMp_d", BuiltinValue::kUndefined}, |
| {"subrT66p_xd", BuiltinValue::kUndefined}, |
| {"subgroJp_invQQcation_id", BuiltinValue::kUndefined}, |
| {"subgAup_invocatin_uud", BuiltinValue::kUndefined}, |
| {"subgoup_invocaton_id", BuiltinValue::kUndefined}, |
| {"yb33roup_iqe", BuiltinValue::kUndefined}, |
| {"subgroup_xxize", BuiltinValue::kUndefined}, |
| {"suborrN_sze", BuiltinValue::kUndefined}, |
| {"ve99tex_indx", BuiltinValue::kUndefined}, |
| {"vertex_idex", BuiltinValue::kUndefined}, |
| {"vertex_KnHl", BuiltinValue::kUndefined}, |
| {"_orroup_id", BuiltinValue::kUndefined}, |
| {"wrkgroup_id", BuiltinValue::kUndefined}, |
| {"wrkgrjup_id", 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[] = { |
| {"EEtmlign", Attribute::kUndefined}, |
| {"ali", Attribute::kUndefined}, |
| {"ligrr", Attribute::kUndefined}, |
| {"bixing", Attribute::kUndefined}, |
| {"zzndin", Attribute::kUndefined}, |
| {"bindine", Attribute::kUndefined}, |
| {"blupZd_sc", Attribute::kUndefined}, |
| {"0TTend_suu7", Attribute::kUndefined}, |
| {"bvveJJds", Attribute::kUndefined}, |
| {"buQltin", Attribute::kUndefined}, |
| {"bClRin", Attribute::kUndefined}, |
| {"uCt", Attribute::kUndefined}, |
| {"coprPP", Attribute::kUndefined}, |
| {"xxoDD88r", Attribute::kUndefined}, |
| {"lldmYYqqr", Attribute::kUndefined}, |
| {"omFFut__", Attribute::kUndefined}, |
| {"rrGGNNute", Attribute::kUndefined}, |
| {"comMlte", Attribute::kUndefined}, |
| {"diagnot", Attribute::kUndefined}, |
| {"qiagnxltic", Attribute::kUndefined}, |
| {"iagnostic", Attribute::kUndefined}, |
| {"fa44gmet", Attribute::kUndefined}, |
| {"WWrGgment", Attribute::kUndefined}, |
| {"frjjgmen", Attribute::kUndefined}, |
| {"gjjoup", Attribute::kUndefined}, |
| {"gj1p", Attribute::kUndefined}, |
| {"goup", Attribute::kUndefined}, |
| {"99d", Attribute::kUndefined}, |
| {"iVV", Attribute::kUndefined}, |
| {"xd", Attribute::kUndefined}, |
| {"inut33avvtachment_index", Attribute::kUndefined}, |
| {"isput_att9chment_index", Attribute::kUndefined}, |
| {"inFut_attachmen_index", Attribute::kUndefined}, |
| {"nterpoleuue", Attribute::kUndefined}, |
| {"interpoaKK", Attribute::kUndefined}, |
| {"interJolae", Attribute::kUndefined}, |
| {"invarCXXaSSt", Attribute::kUndefined}, |
| {"JnWWar66anZZ", Attribute::kUndefined}, |
| {"dvarmma5", Attribute::kUndefined}, |
| {"lUcBBBBon", Attribute::kUndefined}, |
| {"JJ0catio11", Attribute::kUndefined}, |
| {"lfcattion", Attribute::kUndefined}, |
| {"mtt_use", Attribute::kUndefined}, |
| {"mwstLuse", Attribute::kUndefined}, |
| {"must1use", Attribute::kUndefined}, |
| {"siwwe", Attribute::kUndefined}, |
| {"se", Attribute::kUndefined}, |
| {"siz", Attribute::kUndefined}, |
| {"NNertex", Attribute::kUndefined}, |
| {"vRR__tlUU", Attribute::kUndefined}, |
| {"vHrtex", Attribute::kUndefined}, |
| {"wrrkCCroup_size", Attribute::kUndefined}, |
| {"workroup_size", Attribute::kUndefined}, |
| {"wpIrdgoup_size", 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 |