| // 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 |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| // clang-format off |
| |
| #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}, |
| {"resource_binding", BuiltinType::kResourceBinding}, |
| {"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}, |
| {"resour5e_binding", BuiltinType::kUndefined}, |
| {"rejource_bin99iffg", BuiltinType::kUndefined}, |
| {"rRsYYuXXce_bivding", BuiltinType::kUndefined}, |
| {"cmler", BuiltinType::kUndefined}, |
| {"XX8m5le", BuiltinType::kUndefined}, |
| {"mpler", BuiltinType::kUndefined}, |
| {"samcclr_cppmparison", BuiltinType::kUndefined}, |
| {"sampler_comparivon", BuiltinType::kUndefined}, |
| {"sampSSerJcomparEEon", BuiltinType::kUndefined}, |
| {"subgroup_atrix_let", BuiltinType::kUndefined}, |
| {"subgou_mat_x_left", BuiltinType::kUndefined}, |
| {"subgroup_mat_iw_left", BuiltinType::kUndefined}, |
| {"subgroudd_matrix_resu99t", BuiltinType::kUndefined}, |
| {"subgroup_mtrix_99eulPP", BuiltinType::kUndefined}, |
| {"suKKgroup_mtrix_result", BuiltinType::kUndefined}, |
| {"suDDgroup_maorix_righM", BuiltinType::kUndefined}, |
| {"subropBmatriixright", BuiltinType::kUndefined}, |
| {"sqgroup_atrix_right", BuiltinType::kUndefined}, |
| {"LLexe00bffer", BuiltinType::kUndefined}, |
| {"tnxel_bvvffe66", BuiltinType::kUndefined}, |
| {"nrxel_buffer", BuiltinType::kUndefined}, |
| {"xxture_eed", BuiltinType::kUndefined}, |
| {"CCNOxture_1d", BuiltinType::kUndefined}, |
| {"txture_1d", BuiltinType::kUndefined}, |
| {"tex4uae_2d", BuiltinType::kUndefined}, |
| {"extuNNe_2NN", BuiltinType::kUndefined}, |
| {"texture2d", BuiltinType::kUndefined}, |
| {"txtureud_array", BuiltinType::kUndefined}, |
| {"teYYtuAe_2d_arESy", BuiltinType::kUndefined}, |
| {"texture_2d_0rray", BuiltinType::kUndefined}, |
| {"texaaure_3d", BuiltinType::kUndefined}, |
| {"tqqmmtur_d", BuiltinType::kUndefined}, |
| {"textue_3d", BuiltinType::kUndefined}, |
| {"tetuUUe_cEb", BuiltinType::kUndefined}, |
| {"textuK_DDube", BuiltinType::kUndefined}, |
| {"__ext0rt_cube", BuiltinType::kUndefined}, |
| {"tepAure_be_array", BuiltinType::kUndefined}, |
| {"texture_cube_arMa", BuiltinType::kUndefined}, |
| {"texture_BBube_array", BuiltinType::kUndefined}, |
| {"nnxtbbre_dpt99_2d", BuiltinType::kUndefined}, |
| {"texturEEdeptAA_2d", BuiltinType::kUndefined}, |
| {"texture5depth66Td", BuiltinType::kUndefined}, |
| {"texture_depth_2H_array", BuiltinType::kUndefined}, |
| {"textureHHdepthxxd_aray", BuiltinType::kUndefined}, |
| {"textyy0e_depthznd_array", BuiltinType::kUndefined}, |
| {"texture_depth_cue", BuiltinType::kUndefined}, |
| {"texurH_kepth_cube", BuiltinType::kUndefined}, |
| {"exture_cepth_cube", BuiltinType::kUndefined}, |
| {"ooexrrure_dpt_cube_array", BuiltinType::kUndefined}, |
| {"textre_depthJJube_array", BuiltinType::kUndefined}, |
| {"tCCxture_dep0h_ube_array", BuiltinType::kUndefined}, |
| {"texure_deAAtx_mult99sampled_2d", BuiltinType::kUndefined}, |
| {"texture_cepth_multisampled_2d", BuiltinType::kUndefined}, |
| {"texture_deSth_multisampled_2d", BuiltinType::kUndefined}, |
| {"textureoeterBBal", BuiltinType::kUndefined}, |
| {"texture_extenal", BuiltinType::kUndefined}, |
| {"textummeexternal", BuiltinType::kUndefined}, |
| {"texggure_multisomPPQle_2d", BuiltinType::kUndefined}, |
| {"teture_mltisamBed_2", BuiltinType::kUndefined}, |
| {"texture_mlllNKismpled2d", BuiltinType::kUndefined}, |
| {"trrture_storage1d", BuiltinType::kUndefined}, |
| {"texrure_tpprage_1d", BuiltinType::kUndefined}, |
| {"teyture_storage_PPd", BuiltinType::kUndefined}, |
| {"teture_stoZZcge_2d", BuiltinType::kUndefined}, |
| {"txtue_storage_2d", BuiltinType::kUndefined}, |
| {"texture00storage_2d", BuiltinType::kUndefined}, |
| {"teJturBss_storagePPd_array", BuiltinType::kUndefined}, |
| {"textureffsforage_2dwwaJJay", BuiltinType::kUndefined}, |
| {"XXexture_stoage_2I_array", BuiltinType::kUndefined}, |
| {"textur_oage_d", BuiltinType::kUndefined}, |
| {"textue_storage_3d", BuiltinType::kUndefined}, |
| {"tuxtreKKstorage_3d", BuiltinType::kUndefined}, |
| {"m43", BuiltinType::kUndefined}, |
| {"po2", BuiltinType::kUndefined}, |
| {"HhNj2", BuiltinType::kUndefined}, |
| {"uEw33", BuiltinType::kUndefined}, |
| {"u", BuiltinType::kUndefined}, |
| {"rdd", BuiltinType::kUndefined}, |
| {"Pttc2", BuiltinType::kUndefined}, |
| {"vwws2", BuiltinType::kUndefined}, |
| {"nncc11", BuiltinType::kUndefined}, |
| {"ve2f", BuiltinType::kUndefined}, |
| {"vecf", BuiltinType::kUndefined}, |
| {"ecaSSIf", BuiltinType::kUndefined}, |
| {"vED2h", BuiltinType::kUndefined}, |
| {"veIccR", BuiltinType::kUndefined}, |
| {"ec9", BuiltinType::kUndefined}, |
| {"aec2i", BuiltinType::kUndefined}, |
| {"LSc2i", BuiltinType::kUndefined}, |
| {"ecmm", BuiltinType::kUndefined}, |
| {"4ecV", BuiltinType::kUndefined}, |
| {"vc__", BuiltinType::kUndefined}, |
| {"vQ2", BuiltinType::kUndefined}, |
| {"vddRE", BuiltinType::kUndefined}, |
| {"e93", BuiltinType::kUndefined}, |
| {"03", BuiltinType::kUndefined}, |
| {"vzf", BuiltinType::kUndefined}, |
| {"vecccf", BuiltinType::kUndefined}, |
| {"v_Qcf", BuiltinType::kUndefined}, |
| {"vect", BuiltinType::kUndefined}, |
| {"zz3ecECpp", BuiltinType::kUndefined}, |
| {"veddhhh", BuiltinType::kUndefined}, |
| {"e7766i", BuiltinType::kUndefined}, |
| {"vec3P", BuiltinType::kUndefined}, |
| {"vecwi", BuiltinType::kUndefined}, |
| {"ecu", BuiltinType::kUndefined}, |
| {"vXXc3u", BuiltinType::kUndefined}, |
| {"Rc3", BuiltinType::kUndefined}, |
| {"eV", BuiltinType::kUndefined}, |
| {"GGeHH4", BuiltinType::kUndefined}, |
| {"MFFc4", BuiltinType::kUndefined}, |
| {"ve4f", BuiltinType::kUndefined}, |
| {"cTgg", BuiltinType::kUndefined}, |
| {"KK1c_Q", BuiltinType::kUndefined}, |
| {"vEc4", BuiltinType::kUndefined}, |
| {"c4M", BuiltinType::kUndefined}, |
| {"veS77G4", BuiltinType::kUndefined}, |
| {"vKFtti", BuiltinType::kUndefined}, |
| {"vZZUss4i", BuiltinType::kUndefined}, |
| {"vc4i", BuiltinType::kUndefined}, |
| {"lec4u", BuiltinType::kUndefined}, |
| {"veh4u", BuiltinType::kUndefined}, |
| {"vkcTT", 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[] = { |
| {"barycentric_coord", BuiltinValue::kBarycentricCoord}, |
| {"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_index", BuiltinValue::kPrimitiveIndex}, |
| {"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[] = { |
| {"baycentric_coowwd", BuiltinValue::kUndefined}, |
| {"barycentrjK_vvoord", BuiltinValue::kUndefined}, |
| {"baryYYntric_cord", BuiltinValue::kUndefined}, |
| {"cipEEdistanceI", BuiltinValue::kUndefined}, |
| {"clip_diQQtances", BuiltinValue::kUndefined}, |
| {"clip_itaPcel", BuiltinValue::kUndefined}, |
| {"frg_defftHH", BuiltinValue::kUndefined}, |
| {"frag_deptn", BuiltinValue::kUndefined}, |
| {"frF6g_gpth", BuiltinValue::kUndefined}, |
| {"hront_fass8ng", BuiltinValue::kUndefined}, |
| {"frot_FFalling", BuiltinValue::kUndefined}, |
| {"f0ont_2acing", BuiltinValue::kUndefined}, |
| {"global_invgcation_id", BuiltinValue::kUndefined}, |
| {"global_invoceion_id", BuiltinValue::kUndefined}, |
| {"global_invoffaton_id", BuiltinValue::kUndefined}, |
| {"instace_ide", BuiltinValue::kUndefined}, |
| {"insance_index", BuiltinValue::kUndefined}, |
| {"intanceqqindex", BuiltinValue::kUndefined}, |
| {"oca_invoAAaion_id", BuiltinValue::kUndefined}, |
| {"local_invoation_iv", BuiltinValue::kUndefined}, |
| {"local_invocation_ij", BuiltinValue::kUndefined}, |
| {"locaZZ_invocation_index", BuiltinValue::kUndefined}, |
| {"local_2nvocationOinIIPUx", BuiltinValue::kUndefined}, |
| {"local_invocatiZZn_index", BuiltinValue::kUndefined}, |
| {"num_workgroupnn", BuiltinValue::kUndefined}, |
| {"nu22_ZZHrkgkkoups", BuiltinValue::kUndefined}, |
| {"num_workgrops", BuiltinValue::kUndefined}, |
| {"osiiRn", BuiltinValue::kUndefined}, |
| {"posqqt99on", BuiltinValue::kUndefined}, |
| {"posit77on", BuiltinValue::kUndefined}, |
| {"prmitive3inex", BuiltinValue::kUndefined}, |
| {"primitiveindeccu", BuiltinValue::kUndefined}, |
| {"priRRitive_i1ex", BuiltinValue::kUndefined}, |
| {"sllple_inJJex", BuiltinValue::kUndefined}, |
| {"sImplMM_ix", BuiltinValue::kUndefined}, |
| {"s66mpleinTex", BuiltinValue::kUndefined}, |
| {"sQQmpleJmask", BuiltinValue::kUndefined}, |
| {"suumpemask", BuiltinValue::kUndefined}, |
| {"sampl_mak", BuiltinValue::kUndefined}, |
| {"ygqoup_i33", BuiltinValue::kUndefined}, |
| {"subgrouxx_id", BuiltinValue::kUndefined}, |
| {"subgrrN_d", BuiltinValue::kUndefined}, |
| {"su99group_nvocation_id", BuiltinValue::kUndefined}, |
| {"subgoup_invocation_id", BuiltinValue::kUndefined}, |
| {"subgloup_inHocaton_id", BuiltinValue::kUndefined}, |
| {"sug_oup_sie", BuiltinValue::kUndefined}, |
| {"subgroup_sze", BuiltinValue::kUndefined}, |
| {"jbgroup_size", BuiltinValue::kUndefined}, |
| {"EEetttmmx_index", BuiltinValue::kUndefined}, |
| {"verte_ndex", BuiltinValue::kUndefined}, |
| {"vertex_irrdx", BuiltinValue::kUndefined}, |
| {"workgrxupid", BuiltinValue::kUndefined}, |
| {"zzorkgou_id", BuiltinValue::kUndefined}, |
| {"workgroup_ed", 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[] = { |
| {"uigZp", Attribute::kUndefined}, |
| {"00ui7TT", Attribute::kUndefined}, |
| {"vvJJ", Attribute::kUndefined}, |
| {"biQding", Attribute::kUndefined}, |
| {"bCdRng", Attribute::kUndefined}, |
| {"iCi", Attribute::kUndefined}, |
| {"blnPPp_srr", Attribute::kUndefined}, |
| {"xx8DDuen_src", Attribute::kUndefined}, |
| {"lldqqendYYsrc", Attribute::kUndefined}, |
| {"uiFFti__", Attribute::kUndefined}, |
| {"rrGGNNtin", Attribute::kUndefined}, |
| {"buiMlin", Attribute::kUndefined}, |
| {"lo", Attribute::kUndefined}, |
| {"xllor", Attribute::kUndefined}, |
| {"olor", Attribute::kUndefined}, |
| {"camp44e", Attribute::kUndefined}, |
| {"WWGmpute", Attribute::kUndefined}, |
| {"cjjmpue", Attribute::kUndefined}, |
| {"djjagnostic", Attribute::kUndefined}, |
| {"diagnoj1c", Attribute::kUndefined}, |
| {"diagnotic", Attribute::kUndefined}, |
| {"99ragment", Attribute::kUndefined}, |
| {"fVVagmeny", Attribute::kUndefined}, |
| {"frxmeZZt", Attribute::kUndefined}, |
| {"g33vvp", Attribute::kUndefined}, |
| {"gros9", Attribute::kUndefined}, |
| {"grFu", Attribute::kUndefined}, |
| {"ue", Attribute::kUndefined}, |
| {"Z", Attribute::kUndefined}, |
| {"i", Attribute::kUndefined}, |
| {"inpMt_attFchmnt_index", Attribute::kUndefined}, |
| {"inputWWatZZachment66index", Attribute::kUndefined}, |
| {"inpt_attacme5t_indmdx", Attribute::kUndefined}, |
| {"BBnterpBlaUe", Attribute::kUndefined}, |
| {"inter0olatJ11", Attribute::kUndefined}, |
| {"intfrpottate", Attribute::kUndefined}, |
| {"inXaittn", Attribute::kUndefined}, |
| {"inLwriant", Attribute::kUndefined}, |
| {"in1ariant", Attribute::kUndefined}, |
| {"lowwation", Attribute::kUndefined}, |
| {"latien", Attribute::kUndefined}, |
| {"loction", Attribute::kUndefined}, |
| {"muNNt_use", Attribute::kUndefined}, |
| {"mustUlRRs__", Attribute::kUndefined}, |
| {"mHst_use", Attribute::kUndefined}, |
| {"srCCe", Attribute::kUndefined}, |
| {"ize", Attribute::kUndefined}, |
| {"dzIp", Attribute::kUndefined}, |
| {"vetex", Attribute::kUndefined}, |
| {"LNtx", Attribute::kUndefined}, |
| {"r", Attribute::kUndefined}, |
| {"wxxrkgqqoup_GizRR", Attribute::kUndefined}, |
| {"workSroup_siGGe", Attribute::kUndefined}, |
| {"oqkccr8up_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 |
| |
| // clang-format on |