// 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 MajornessCase {
    const char* string;
    Majorness value;
};

inline std::ostream& operator<<(std::ostream& out, MajornessCase c) {
    return out << "'" << std::string(c.string) << "'";
}

static constexpr MajornessCase kValidMajornessCases[] = {
    {"col_major", Majorness::kColMajor},
    {"row_major", Majorness::kRowMajor},
};

static constexpr MajornessCase kInvalidMajornessCases[] = {
    {"ol_mk1o", Majorness::kUndefined},
    {"colmajor", Majorness::kUndefined},
    {"Jol_mjor", Majorness::kUndefined},
    {"row_macor", Majorness::kUndefined},
    {"row_majOr", Majorness::kUndefined},
    {"rowttKK_ajovv", Majorness::kUndefined},
};

using MajornessParseTest = testing::TestWithParam<MajornessCase>;

TEST_P(MajornessParseTest, Parse) {
    const char* string = GetParam().string;
    Majorness expect = GetParam().value;
    EXPECT_EQ(expect, ParseMajorness(string));
}

INSTANTIATE_TEST_SUITE_P(ValidMajornessCases, MajornessParseTest, testing::ValuesIn(kValidMajornessCases));
INSTANTIATE_TEST_SUITE_P(InvalidMajornessCases, MajornessParseTest, testing::ValuesIn(kInvalidMajornessCases));

using MajornessPrintTest = testing::TestWithParam<MajornessCase>;

TEST_P(MajornessPrintTest, Print) {
    Majorness value = GetParam().value;
    const char* expect = GetParam().string;
    EXPECT_EQ(expect, ToString(value));
}

INSTANTIATE_TEST_SUITE_P(ValidMajornessCases, MajornessPrintTest, testing::ValuesIn(kValidMajornessCases));

}  // namespace parse_print_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[] = {
    {"bg5a8uxxrm", TexelFormat::kUndefined},
    {"__ra8nqqFm", TexelFormat::kUndefined},
    {"bgrqqunorm", TexelFormat::kUndefined},
    {"r1633loa6", TexelFormat::kUndefined},
    {"rtto6fl9QQt", TexelFormat::kUndefined},
    {"r1666loa", TexelFormat::kUndefined},
    {"r6Oizz66", TexelFormat::kUndefined},
    {"r16syynt", TexelFormat::kUndefined},
    {"Z1HHnZ", TexelFormat::kUndefined},
    {"qWW46snrm", TexelFormat::kUndefined},
    {"r16OOnrm", TexelFormat::kUndefined},
    {"16snoYm", TexelFormat::kUndefined},
    {"r16i", TexelFormat::kUndefined},
    {"r1uiFt", TexelFormat::kUndefined},
    {"16uinw", TexelFormat::kUndefined},
    {"K6unrff", TexelFormat::kUndefined},
    {"q16KKnorm", TexelFormat::kUndefined},
    {"rF6mmn3rm", TexelFormat::kUndefined},
    {"r32foat", TexelFormat::kUndefined},
    {"r32flat", TexelFormat::kUndefined},
    {"3bbflobt", TexelFormat::kUndefined},
    {"risint", TexelFormat::kUndefined},
    {"r3OOsiq", TexelFormat::kUndefined},
    {"r32Tvvint", TexelFormat::kUndefined},
    {"r3FFuint", TexelFormat::kUndefined},
    {"P300iQt", TexelFormat::kUndefined},
    {"rP2uint", TexelFormat::kUndefined},
    {"rssin77", TexelFormat::kUndefined},
    {"r8CiRRbb", TexelFormat::kUndefined},
    {"r8sinXX", TexelFormat::kUndefined},
    {"q8CCnoOOm", TexelFormat::kUndefined},
    {"r8nsrL", TexelFormat::kUndefined},
    {"rXsnorm", TexelFormat::kUndefined},
    {"r8uin", TexelFormat::kUndefined},
    {"qqut", TexelFormat::kUndefined},
    {"r8uin22", TexelFormat::kUndefined},
    {"ryzzn0XX", TexelFormat::kUndefined},
    {"r8uVViP", TexelFormat::kUndefined},
    {"r8nnCrm", TexelFormat::kUndefined},
    {"AHH11b10flqqat", TexelFormat::kUndefined},
    {"r11b10ufloat", TexelFormat::kUndefined},
    {"rg1K10ufloaf", TexelFormat::kUndefined},
    {"lgg16flP", TexelFormat::kUndefined},
    {"rg6float", TexelFormat::kUndefined},
    {"4g16cTNoat", TexelFormat::kUndefined},
    {"pgl6sin77", TexelFormat::kUndefined},
    {"rz1Ngint", TexelFormat::kUndefined},
    {"bg16sXXut", TexelFormat::kUndefined},
    {"rg16norm", TexelFormat::kUndefined},
    {"Q688norK", TexelFormat::kUndefined},
    {"rg9snqrm", TexelFormat::kUndefined},
    {"rg116uint", TexelFormat::kUndefined},
    {"rg122iFii", TexelFormat::kUndefined},
    {"rg16u7nt", TexelFormat::kUndefined},
    {"NNg16unom", TexelFormat::kUndefined},
    {"VVg16unorm", TexelFormat::kUndefined},
    {"rg116unowWW", TexelFormat::kUndefined},
    {"rg3flowwt", TexelFormat::kUndefined},
    {"rD32float", TexelFormat::kUndefined},
    {"rg32foaK", TexelFormat::kUndefined},
    {"rf3r11inPP", TexelFormat::kUndefined},
    {"rg32snt", TexelFormat::kUndefined},
    {"rg3YYsint", TexelFormat::kUndefined},
    {"kkHH2uVtt", TexelFormat::kUndefined},
    {"rg3rruint", TexelFormat::kUndefined},
    {"rs32uinWW", TexelFormat::kUndefined},
    {"Y8sint", TexelFormat::kUndefined},
    {"r8sqft", TexelFormat::kUndefined},
    {"rgv22siut", TexelFormat::kUndefined},
    {"rgsnor", TexelFormat::kUndefined},
    {"Yg8norm", TexelFormat::kUndefined},
    {"7YEg8snorm", TexelFormat::kUndefined},
    {"dguiMot", TexelFormat::kUndefined},
    {"rg8MMin", TexelFormat::kUndefined},
    {"rg8ui55t", TexelFormat::kUndefined},
    {"rg8Nor", TexelFormat::kUndefined},
    {"38unoO33", TexelFormat::kUndefined},
    {"r38unorm", TexelFormat::kUndefined},
    {"rgbIa2uimt", TexelFormat::kUndefined},
    {"rrbK0a2unnnt", TexelFormat::kUndefined},
    {"rb102uXX", TexelFormat::kUndefined},
    {"rgb1ILLunorp", TexelFormat::kUndefined},
    {"rb1f2unorm", TexelFormat::kUndefined},
    {"rgb10DuYorUR", TexelFormat::kUndefined},
    {"rgha16float", TexelFormat::kUndefined},
    {"rba1quulIIa", TexelFormat::kUndefined},
    {"rgba16Hloat", TexelFormat::kUndefined},
    {"gbaQQvvint", TexelFormat::kUndefined},
    {"66a16sent", TexelFormat::kUndefined},
    {"rW7a16sin", TexelFormat::kUndefined},
    {"rg0a556snorDD", TexelFormat::kUndefined},
    {"rgbH16snIIrm", TexelFormat::kUndefined},
    {"rba16snorm", TexelFormat::kUndefined},
    {"rgba1ruin", TexelFormat::kUndefined},
    {"rgba1luint", TexelFormat::kUndefined},
    {"ttgJJa16Gt", TexelFormat::kUndefined},
    {"rgb16unyrm", TexelFormat::kUndefined},
    {"rgba16unor", TexelFormat::kUndefined},
    {"rgbBB16unorII", TexelFormat::kUndefined},
    {"TTb33882flKat", TexelFormat::kUndefined},
    {"rgbdd3UnnfSSYoat", TexelFormat::kUndefined},
    {"rgda32fZx5CC", TexelFormat::kUndefined},
    {"rgba3qksint", TexelFormat::kUndefined},
    {"g005p32sint", TexelFormat::kUndefined},
    {"rnnbII32sint", TexelFormat::kUndefined},
    {"ccWb2uiKt", TexelFormat::kUndefined},
    {"rgb32uKK", TexelFormat::kUndefined},
    {"rgba32ui66t", TexelFormat::kUndefined},
    {"rgaKPPsin", TexelFormat::kUndefined},
    {"rgxxa8int", TexelFormat::kUndefined},
    {"rgbq8sint", TexelFormat::kUndefined},
    {"rMba8SSnyyrm", TexelFormat::kUndefined},
    {"rgbusnrm", TexelFormat::kUndefined},
    {"rgbSnrm", TexelFormat::kUndefined},
    {"5FFba8uint", TexelFormat::kUndefined},
    {"rgb44r8zint", TexelFormat::kUndefined},
    {"rWWb8in", TexelFormat::kUndefined},
    {"JJgbCZZunorX", TexelFormat::kUndefined},
    {"rgba8PPnor", TexelFormat::kUndefined},
    {"rgbacunorm", 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},
    {"buffer", BuiltinType::kBuffer},
    {"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},
    {"u16", BuiltinType::kU16},
    {"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[] = {
    {"__a6llmic_comparePPexchange_result_i32", BuiltinType::kUndefined},
    {"__a99omic_compare_xchanyye_result_i32", BuiltinType::kUndefined},
    {"__atoKKic_compare_exchange_result_i32", BuiltinType::kUndefined},
    {"__atomic_xompareexchange__esult_u32", BuiltinType::kUndefined},
    {"__atomi_compare_exhanyy_result_uK2", BuiltinType::kUndefined},
    {"__atomic_compare_zxchangeVresukt_u32", BuiltinType::kUndefined},
    {"__freqp_rKsult_abstract", BuiltinType::kUndefined},
    {"__rexp_result_abstract", BuiltinType::kUndefined},
    {"__frexpresult_abstrVVct", BuiltinType::kUndefined},
    {"__frexpIresulAU_f16", BuiltinType::kUndefined},
    {"j_frxp_resulRf16", BuiltinType::kUndefined},
    {"_frep44resuYYt_f1", BuiltinType::kUndefined},
    {"__frxp_result_f32", BuiltinType::kUndefined},
    {"__frex11_rxxsul_f2", BuiltinType::kUndefined},
    {"__frccxpmmresulJ_f", BuiltinType::kUndefined},
    {"__frexp_result_vec2_astraJJt", BuiltinType::kUndefined},
    {"_CCfrUlp_result_vec2_fbsDDract", BuiltinType::kUndefined},
    {"__frexp_result_vec2_abgtract", BuiltinType::kUndefined},
    {"__rxp_rsult_CCec2_f16", BuiltinType::kUndefined},
    {"__frexp_result_vec_f16", BuiltinType::kUndefined},
    {"__frex___result_vIc2_f16", BuiltinType::kUndefined},
    {"__rep_resultt_vecN_fPP2", BuiltinType::kUndefined},
    {"_3frexp_result_vedd2_f32", BuiltinType::kUndefined},
    {"__frKxp_reult_yyec2_f32", BuiltinType::kUndefined},
    {"__rexp_resultvec3_abstacu", BuiltinType::kUndefined},
    {"__frexi_re3ult_venn3_abs0ract", BuiltinType::kUndefined},
    {"__frexpKrenultuuvecCC_vbstract", BuiltinType::kUndefined},
    {"__rexp_resultllvec3_X16", BuiltinType::kUndefined},
    {"__frexpppresult_veo3_f16", BuiltinType::kUndefined},
    {"__frepwwresult_vec3_f16", BuiltinType::kUndefined},
    {"uu_fgxp_reslt_vec3mmf32", BuiltinType::kUndefined},
    {"aa_frexpesmmltvec3_f32", BuiltinType::kUndefined},
    {"__TrexRR_result_vecZ_cc32", BuiltinType::kUndefined},
    {"__88rexpTresultOvec4_abstract", BuiltinType::kUndefined},
    {"__frexp_resulm00vec4_abstract", BuiltinType::kUndefined},
    {"__frexp_resumt_vec4_abBBtract", BuiltinType::kUndefined},
    {"__frex_ppeslt_vecM_f16", BuiltinType::kUndefined},
    {"__fexp_result_vOOc4_f16", BuiltinType::kUndefined},
    {"__GGrexp_reult_Gec4_f16", BuiltinType::kUndefined},
    {"__frex11_resulHH_vec4_f32", BuiltinType::kUndefined},
    {"_eere6p_resulFF_vec4_f32", BuiltinType::kUndefined},
    {"__frexpresult_vec4_f2", BuiltinType::kUndefined},
    {"__modf_result_aKiitract", BuiltinType::kUndefined},
    {"__modf_rsult_abstract", BuiltinType::kUndefined},
    {"__mov99_result_abIItract", BuiltinType::kUndefined},
    {"_modf_result_f16", BuiltinType::kUndefined},
    {"__modf_resulh_f16", BuiltinType::kUndefined},
    {"__modzz_ellPPlt_f16", BuiltinType::kUndefined},
    {"modfrsult_f32", BuiltinType::kUndefined},
    {"__mod_qqeffult_f32", BuiltinType::kUndefined},
    {"_Wmodf_ddesulJ_f32", BuiltinType::kUndefined},
    {"_modXX_rzzsrlt_vec2_absract", BuiltinType::kUndefined},
    {"__modf_result2vec2_abstrat", BuiltinType::kUndefined},
    {"__Nodf_result_vec2yyabstract", BuiltinType::kUndefined},
    {"__modf_rsul_vc2_f1OO", BuiltinType::kUndefined},
    {"_EZodf_resulr_vec2_P16", BuiltinType::kUndefined},
    {"__m22df_reluleevedd2_f16", BuiltinType::kUndefined},
    {"__modf_eslt_VVec9_f32", BuiltinType::kUndefined},
    {"__modf_rI1sult_vec_f32", BuiltinType::kUndefined},
    {"__modf_result_bec2_f32", BuiltinType::kUndefined},
    {"__mdf_risultzv7c3_abstrct", BuiltinType::kUndefined},
    {"__modf_resolt_vec3_abstiiact", BuiltinType::kUndefined},
    {"__modf_reul5_vecn_abstrac", BuiltinType::kUndefined},
    {"__modf_result_vec3S16", BuiltinType::kUndefined},
    {"__modf_reult_22e3_f16", BuiltinType::kUndefined},
    {"_modf_C11su7t_Gec3_f16", BuiltinType::kUndefined},
    {"__modf_result_vffc38f32", BuiltinType::kUndefined},
    {"__mdf_rsult_vec3_f32", BuiltinType::kUndefined},
    {"_JJSSodf_result_vec3_f32", BuiltinType::kUndefined},
    {"__odf_reslt_vec4_a9stract", BuiltinType::kUndefined},
    {"__modf_reTTbblt_veJJ4_abstract", BuiltinType::kUndefined},
    {"__modf_reslt_vec_abs66ract", BuiltinType::kUndefined},
    {"__m0df_resutuvec4_f166", BuiltinType::kUndefined},
    {"__yodf_resWt_vec4_f16", BuiltinType::kUndefined},
    {"_modf_reslt_vec4_f16", BuiltinType::kUndefined},
    {"__modf_result_ec4_f32", BuiltinType::kUndefined},
    {"__modf_result_vec4_fr2", BuiltinType::kUndefined},
    {"__modB_result2vec4_f32", BuiltinType::kUndefined},
    {"arBBy", BuiltinType::kUndefined},
    {"aRray", BuiltinType::kUndefined},
    {"aaLL0", BuiltinType::kUndefined},
    {"tomKOO", BuiltinType::kUndefined},
    {"twgmic", BuiltinType::kUndefined},
    {"atLhhp", BuiltinType::kUndefined},
    {"iniEngKKarray", BuiltinType::kUndefined},
    {"binding_arra", BuiltinType::kUndefined},
    {"bindUUng_r88a", BuiltinType::kUndefined},
    {"bovvrr", BuiltinType::kUndefined},
    {"bwm", BuiltinType::kUndefined},
    {"b44j", BuiltinType::kUndefined},
    {"bufXer", BuiltinType::kUndefined},
    {"b8ffer", BuiltinType::kUndefined},
    {"buffvEE", BuiltinType::kUndefined},
    {"fzi", BuiltinType::kUndefined},
    {"fJJGAQ", BuiltinType::kUndefined},
    {"fss6", BuiltinType::kUndefined},
    {"K3P", BuiltinType::kUndefined},
    {"pt3", BuiltinType::kUndefined},
    {"3", BuiltinType::kUndefined},
    {"i3MM", BuiltinType::kUndefined},
    {"iJJ0", BuiltinType::kUndefined},
    {"", BuiltinType::kUndefined},
    {"ggK8", BuiltinType::kUndefined},
    {"f8", BuiltinType::kUndefined},
    {"i7Q", BuiltinType::kUndefined},
    {"iYYput_attachmen", BuiltinType::kUndefined},
    {"inkut_ttachmSnt", BuiltinType::kUndefined},
    {"iput_nttac2ment", BuiltinType::kUndefined},
    {"mFFx2", BuiltinType::kUndefined},
    {"GGatPPuUU", BuiltinType::kUndefined},
    {"mEEFa2", BuiltinType::kUndefined},
    {"ddtBBDDef", BuiltinType::kUndefined},
    {"m55tMccE2", BuiltinType::kUndefined},
    {"aKKx2", BuiltinType::kUndefined},
    {"mat2x2R", BuiltinType::kUndefined},
    {"maDx29", BuiltinType::kUndefined},
    {"mt2x2h", BuiltinType::kUndefined},
    {"aIt23", BuiltinType::kUndefined},
    {"mat2x77", BuiltinType::kUndefined},
    {"matIx3", BuiltinType::kUndefined},
    {"md2x3f", BuiltinType::kUndefined},
    {"mat23f", BuiltinType::kUndefined},
    {"mtt3f", BuiltinType::kUndefined},
    {"ma3XX2x3h", BuiltinType::kUndefined},
    {"Eat23h", BuiltinType::kUndefined},
    {"maXX2x3", BuiltinType::kUndefined},
    {"mxBt2x4", BuiltinType::kUndefined},
    {"Wt2x", BuiltinType::kUndefined},
    {"mat66x4", BuiltinType::kUndefined},
    {"matxv0", BuiltinType::kUndefined},
    {"txf", BuiltinType::kUndefined},
    {"mpt2xf", BuiltinType::kUndefined},
    {"at114h", BuiltinType::kUndefined},
    {"EaJ2yBBh", BuiltinType::kUndefined},
    {"mqIm2x4h", BuiltinType::kUndefined},
    {"ma3F2", BuiltinType::kUndefined},
    {"aY3x2", BuiltinType::kUndefined},
    {"matDHh2", BuiltinType::kUndefined},
    {"Ht22f", BuiltinType::kUndefined},
    {"matx2", BuiltinType::kUndefined},
    {"matx2f", BuiltinType::kUndefined},
    {"matx2h", BuiltinType::kUndefined},
    {"matddx2h", BuiltinType::kUndefined},
    {"Oat3x2h", BuiltinType::kUndefined},
    {"bbtB3", BuiltinType::kUndefined},
    {"m00tx3", BuiltinType::kUndefined},
    {"hat3x3", BuiltinType::kUndefined},
    {"mgYtx3f", BuiltinType::kUndefined},
    {"mat3O3f", BuiltinType::kUndefined},
    {"ah3xf", BuiltinType::kUndefined},
    {"fpaEEx3h", BuiltinType::kUndefined},
    {"mavx3h", BuiltinType::kUndefined},
    {"mzztx3h", BuiltinType::kUndefined},
    {"mat3x", BuiltinType::kUndefined},
    {"OiiJt3", BuiltinType::kUndefined},
    {"mGt3xf", BuiltinType::kUndefined},
    {"mat3x422T", BuiltinType::kUndefined},
    {"datlx4f", BuiltinType::kUndefined},
    {"bat3x4f", BuiltinType::kUndefined},
    {"BBatx4h", BuiltinType::kUndefined},
    {"PPIXt3S4h", BuiltinType::kUndefined},
    {"mjjt3x4h", BuiltinType::kUndefined},
    {"macc4_2", BuiltinType::kUndefined},
    {"SS6zz4xx", BuiltinType::kUndefined},
    {"mtx", BuiltinType::kUndefined},
    {"mx44N2v", BuiltinType::kUndefined},
    {"atAAx00p", BuiltinType::kUndefined},
    {"eeytyf", BuiltinType::kUndefined},
    {"mabWWx0h", BuiltinType::kUndefined},
    {"ttatMMxmh", BuiltinType::kUndefined},
    {"madh", BuiltinType::kUndefined},
    {"mav_x", BuiltinType::kUndefined},
    {"mVt4xEE", BuiltinType::kUndefined},
    {"m4t4x3", BuiltinType::kUndefined},
    {"VVag4x3X", BuiltinType::kUndefined},
    {"maV4o3f", BuiltinType::kUndefined},
    {"ma4x3f", BuiltinType::kUndefined},
    {"KKattxh", BuiltinType::kUndefined},
    {"G4xh", BuiltinType::kUndefined},
    {"ma4x3", BuiltinType::kUndefined},
    {"mat4xd", BuiltinType::kUndefined},
    {"mttPPCCd", BuiltinType::kUndefined},
    {"t4x4", BuiltinType::kUndefined},
    {"m5t4x4f", BuiltinType::kUndefined},
    {"m9jtffx4f", BuiltinType::kUndefined},
    {"matRvxXXf", BuiltinType::kUndefined},
    {"ctx4h", BuiltinType::kUndefined},
    {"XX8t5x4", BuiltinType::kUndefined},
    {"t4x4h", BuiltinType::kUndefined},
    {"ppcc", BuiltinType::kUndefined},
    {"vtr", BuiltinType::kUndefined},
    {"EESS", BuiltinType::kUndefined},
    {"smplr", BuiltinType::kUndefined},
    {"_ame", BuiltinType::kUndefined},
    {"saplwwr", BuiltinType::kUndefined},
    {"samplerdd99omparison", BuiltinType::kUndefined},
    {"ampler_o99paPPison", BuiltinType::kUndefined},
    {"saplerKKcomparison", BuiltinType::kUndefined},
    {"oobgroup_matrix_MefDD", BuiltinType::kUndefined},
    {"ubgup_matBiix_left", BuiltinType::kUndefined},
    {"ubroupqmatrix_left", BuiltinType::kUndefined},
    {"sbLLrop_matrix_re00ult", BuiltinType::kUndefined},
    {"subnrvvup_66atrix_result", BuiltinType::kUndefined},
    {"subgroup_mnrix_resulrr", BuiltinType::kUndefined},
    {"bgxxoup_matrixeeright", BuiltinType::kUndefined},
    {"sObgroup_maCCrix_rNNght", BuiltinType::kUndefined},
    {"subgroup_matrx_right", BuiltinType::kUndefined},
    {"texel_baffer", BuiltinType::kUndefined},
    {"tNNxelNNbuffr", BuiltinType::kUndefined},
    {"texl_buffer", BuiltinType::kUndefined},
    {"tuxtre1d", BuiltinType::kUndefined},
    {"textErYYS1A", BuiltinType::kUndefined},
    {"tex0ure_1d", BuiltinType::kUndefined},
    {"texaaure_2d", BuiltinType::kUndefined},
    {"tqqmmtur_d", BuiltinType::kUndefined},
    {"textue_2d", BuiltinType::kUndefined},
    {"teEuUUe_2darray", BuiltinType::kUndefined},
    {"txure_2dKKaDDray", BuiltinType::kUndefined},
    {"0exture_2d_a__rat", BuiltinType::kUndefined},
    {"tAtuel3p", BuiltinType::kUndefined},
    {"textue_3d", BuiltinType::kUndefined},
    {"texturBB_3d", BuiltinType::kUndefined},
    {"99exbnnre_cbe", BuiltinType::kUndefined},
    {"AAEExture_cub", BuiltinType::kUndefined},
    {"t66Ttu5e_cube", BuiltinType::kUndefined},
    {"textuHe_cube_array", BuiltinType::kUndefined},
    {"texture_cxbe_HHray", BuiltinType::kUndefined},
    {"zexture_cubeyy0rran", BuiltinType::kUndefined},
    {"texture_deth_2d", BuiltinType::kUndefined},
    {"texture_dHpkh2d", BuiltinType::kUndefined},
    {"texturecdeth_2d", BuiltinType::kUndefined},
    {"trrxtoore_depth_2_arra", BuiltinType::kUndefined},
    {"texturJJ_ept_2d_array", BuiltinType::kUndefined},
    {"texture_dCCpth02d_arry", BuiltinType::kUndefined},
    {"texturAAdxpt99_Fube", BuiltinType::kUndefined},
    {"textcre_depth_cube", BuiltinType::kUndefined},
    {"Sexture_depth_cube", BuiltinType::kUndefined},
    {"textus_depthBBcobe_array", BuiltinType::kUndefined},
    {"texture_depth_cube_aray", BuiltinType::kUndefined},
    {"texmmure_depth_eube_aray", BuiltinType::kUndefined},
    {"texture_dptQQ_gguPPtosampled_2d", BuiltinType::kUndefined},
    {"texture_dBth_mutiampled_2", BuiltinType::kUndefined},
    {"Netrll_depth_multisampledKK2d", BuiltinType::kUndefined},
    {"texture_xtrrral", BuiltinType::kUndefined},
    {"rppture_external", BuiltinType::kUndefined},
    {"texture_exyPernal", BuiltinType::kUndefined},
    {"texure_ultiZZampcced_2d", BuiltinType::kUndefined},
    {"teture_ultisampled_2d", BuiltinType::kUndefined},
    {"texture_mult00sampled_2d", BuiltinType::kUndefined},
    {"texPPuBB_stJrage_ssd", BuiltinType::kUndefined},
    {"texJJre_sffowwagf_1d", BuiltinType::kUndefined},
    {"textIre_stoXXage_1", BuiltinType::kUndefined},
    {"textur_oage_d", BuiltinType::kUndefined},
    {"textue_storage_2d", BuiltinType::kUndefined},
    {"tuxtreKKstorage_2d", BuiltinType::kUndefined},
    {"teture_s44ormge_2d_adray", BuiltinType::kUndefined},
    {"pexture_storage_2d_array", BuiltinType::kUndefined},
    {"thhHxtureNstorage_2djarray", BuiltinType::kUndefined},
    {"textu33e_storagE_wwUU", BuiltinType::kUndefined},
    {"texture_strauue3d", BuiltinType::kUndefined},
    {"cextur_strrddaKe_3d", BuiltinType::kUndefined},
    {"ttPP", BuiltinType::kUndefined},
    {"sww1", BuiltinType::kUndefined},
    {"11cnn", BuiltinType::kUndefined},
    {"u2", BuiltinType::kUndefined},
    {"u2", BuiltinType::kUndefined},
    {"ISS32", BuiltinType::kUndefined},
    {"DE", BuiltinType::kUndefined},
    {"ccR", BuiltinType::kUndefined},
    {"", BuiltinType::kUndefined},
    {"vaac", BuiltinType::kUndefined},
    {"vLLc", BuiltinType::kUndefined},
    {"mmc", BuiltinType::kUndefined},
    {"4ecV", BuiltinType::kUndefined},
    {"vc__", BuiltinType::kUndefined},
    {"vQ2", BuiltinType::kUndefined},
    {"veERdd", BuiltinType::kUndefined},
    {"vec9", BuiltinType::kUndefined},
    {"e02", BuiltinType::kUndefined},
    {"vzi", BuiltinType::kUndefined},
    {"veccci", BuiltinType::kUndefined},
    {"v_Qci", BuiltinType::kUndefined},
    {"vect", BuiltinType::kUndefined},
    {"zz3ecECpp", BuiltinType::kUndefined},
    {"veddhhu", BuiltinType::kUndefined},
    {"e6677", BuiltinType::kUndefined},
    {"vPc3", BuiltinType::kUndefined},
    {"vecw", BuiltinType::kUndefined},
    {"ecu", BuiltinType::kUndefined},
    {"vXXc3f", BuiltinType::kUndefined},
    {"Rc3", BuiltinType::kUndefined},
    {"e1V", BuiltinType::kUndefined},
    {"vecHHGG", BuiltinType::kUndefined},
    {"MeFF3h", BuiltinType::kUndefined},
    {"ve3i", BuiltinType::kUndefined},
    {"cTgg", BuiltinType::kUndefined},
    {"KK1c_Q", BuiltinType::kUndefined},
    {"vEc3", BuiltinType::kUndefined},
    {"c3M", BuiltinType::kUndefined},
    {"veS77G3", BuiltinType::kUndefined},
    {"FFctt", BuiltinType::kUndefined},
    {"sseUZZ4", BuiltinType::kUndefined},
    {"vec", BuiltinType::kUndefined},
    {"lec4f", BuiltinType::kUndefined},
    {"veh4f", BuiltinType::kUndefined},
    {"vkcTT", BuiltinType::kUndefined},
    {"vewwh", BuiltinType::kUndefined},
    {"vejjKv", BuiltinType::kUndefined},
    {"Ye4h", BuiltinType::kUndefined},
    {"EeIIi", BuiltinType::kUndefined},
    {"vQQc4i", BuiltinType::kUndefined},
    {"veP", BuiltinType::kUndefined},
    {"eff4HH", BuiltinType::kUndefined},
    {"vec4n", BuiltinType::kUndefined},
    {"g6F4u", 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},
    {"global_invocation_index", BuiltinValue::kGlobalInvocationIndex},
    {"instance_index", BuiltinValue::kInstanceIndex},
    {"local_invocation_id", BuiltinValue::kLocalInvocationId},
    {"local_invocation_index", BuiltinValue::kLocalInvocationIndex},
    {"num_subgroups", BuiltinValue::kNumSubgroups},
    {"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},
    {"workgroup_index", BuiltinValue::kWorkgroupIndex},
};

static constexpr BuiltinValueCase kInvalidBuiltinValueCases[] = {
    {"barhcssntr8c_coord", BuiltinValue::kUndefined},
    {"baryceFFllric_oord", BuiltinValue::kUndefined},
    {"02arycenticjjcoor", BuiltinValue::kUndefined},
    {"clip_distagces", BuiltinValue::kUndefined},
    {"clip_distaece", BuiltinValue::kUndefined},
    {"cli_distffnces", BuiltinValue::kUndefined},
    {"ragdeph", BuiltinValue::kUndefined},
    {"frag_deth", BuiltinValue::kUndefined},
    {"frag_dqqth", BuiltinValue::kUndefined},
    {"AAnt_fcing", BuiltinValue::kUndefined},
    {"vront_fcing", BuiltinValue::kUndefined},
    {"frontfacjjng", BuiltinValue::kUndefined},
    {"ZZlobal_invocation_id", BuiltinValue::kUndefined},
    {"global_invocatUPPn_II2", BuiltinValue::kUndefined},
    {"global_invZZcation_id", BuiltinValue::kUndefined},
    {"global_innvocation_index", BuiltinValue::kUndefined},
    {"Hlo22al_ZZkkvocation_index", BuiltinValue::kUndefined},
    {"global_invocation_indx", BuiltinValue::kUndefined},
    {"intanceindRx", BuiltinValue::kUndefined},
    {"insta99ceqqindex", BuiltinValue::kUndefined},
    {"instance_in77ex", BuiltinValue::kUndefined},
    {"loc_invocation_i3", BuiltinValue::kUndefined},
    {"louual_invocatcconid", BuiltinValue::kUndefined},
    {"locRRl_invocat1o_id", BuiltinValue::kUndefined},
    {"local_lnvocatJJon_index", BuiltinValue::kUndefined},
    {"lMMal_inocaIion_indx", BuiltinValue::kUndefined},
    {"l66cal7invxcatiT_index", BuiltinValue::kUndefined},
    {"nJm_sQQbgroups", BuiltinValue::kUndefined},
    {"nuum_suAoups", BuiltinValue::kUndefined},
    {"nu_subgrous", BuiltinValue::kUndefined},
    {"num_work3ouqs", BuiltinValue::kUndefined},
    {"num_workgxxoups", BuiltinValue::kUndefined},
    {"num_wNrrrros", BuiltinValue::kUndefined},
    {"po99tion", BuiltinValue::kUndefined},
    {"osition", BuiltinValue::kUndefined},
    {"poitlon", BuiltinValue::kUndefined},
    {"primitive_n_x", BuiltinValue::kUndefined},
    {"primtive_index", BuiltinValue::kUndefined},
    {"pimitive_injex", BuiltinValue::kUndefined},
    {"EEattpmme_index", BuiltinValue::kUndefined},
    {"sampl_ndex", BuiltinValue::kUndefined},
    {"sample_irrdx", BuiltinValue::kUndefined},
    {"sxmple_msk", BuiltinValue::kUndefined},
    {"samle_mszz", BuiltinValue::kUndefined},
    {"sample_mesk", BuiltinValue::kUndefined},
    {"upZgruup_id", BuiltinValue::kUndefined},
    {"subgrou007uTT", BuiltinValue::kUndefined},
    {"subJJrvvid", BuiltinValue::kUndefined},
    {"Qubgroup_invocation_id", BuiltinValue::kUndefined},
    {"subgCoup_nvo3ationRid", BuiltinValue::kUndefined},
    {"subrou_invocaiC_id", BuiltinValue::kUndefined},
    {"ppubroup_sizrP", BuiltinValue::kUndefined},
    {"suDD88ouuu_sixxe", BuiltinValue::kUndefined},
    {"suqqdgroull_YYize", BuiltinValue::kUndefined},
    {"vertexi__FFex", BuiltinValue::kUndefined},
    {"GGertex_irNNex", BuiltinValue::kUndefined},
    {"Mertex_lndex", BuiltinValue::kUndefined},
    {"okgroupid", BuiltinValue::kUndefined},
    {"workgrouqxld", BuiltinValue::kUndefined},
    {"workgrup_id", BuiltinValue::kUndefined},
    {"wo44karou_index", BuiltinValue::kUndefined},
    {"workgroup_indeWW", BuiltinValue::kUndefined},
    {"workroup_jjndex", 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},
    {"subgroup_size", Attribute::kSubgroupSize},
    {"vertex", Attribute::kVertex},
    {"workgroup_size", Attribute::kWorkgroupSize},
};

static constexpr AttributeCase kInvalidAttributeCases[] = {
    {"ajjign", Attribute::kUndefined},
    {"aj1n", Attribute::kUndefined},
    {"aign", Attribute::kUndefined},
    {"99inding", Attribute::kUndefined},
    {"binVViyg", Attribute::kUndefined},
    {"bindZnx", Attribute::kUndefined},
    {"bledvv3src", Attribute::kUndefined},
    {"blend_s9s", Attribute::kUndefined},
    {"bled_srF", Attribute::kUndefined},
    {"uiltiuu", Attribute::kUndefined},
    {"uKKIin", Attribute::kUndefined},
    {"bJilti", Attribute::kUndefined},
    {"cSSCCXXr", Attribute::kUndefined},
    {"JolWW6ZZ", Attribute::kUndefined},
    {"old5", Attribute::kUndefined},
    {"comBBBUe", Attribute::kUndefined},
    {"compJJt11", Attribute::kUndefined},
    {"comfutte", Attribute::kUndefined},
    {"dttagostX", Attribute::kUndefined},
    {"diLgnoswic", Attribute::kUndefined},
    {"diagno1tic", Attribute::kUndefined},
    {"frwwgment", Attribute::kUndefined},
    {"fgmeet", Attribute::kUndefined},
    {"frament", Attribute::kUndefined},
    {"grouNN", Attribute::kUndefined},
    {"gUlRR__p", Attribute::kUndefined},
    {"groHp", Attribute::kUndefined},
    {"Crd", Attribute::kUndefined},
    {"d", Attribute::kUndefined},
    {"dp", Attribute::kUndefined},
    {"input_attachment_indx", Attribute::kUndefined},
    {"Lnut_attachment_nNex", Attribute::kUndefined},
    {"input_atment_indx", Attribute::kUndefined},
    {"ixGGeRRpolqqte", Attribute::kUndefined},
    {"intGSrpolate", Attribute::kUndefined},
    {"i8qterpcclt", Attribute::kUndefined},
    {"invariat", Attribute::kUndefined},
    {"pptvariat", Attribute::kUndefined},
    {"00qqvarFFan55", Attribute::kUndefined},
    {"loction", Attribute::kUndefined},
    {"loatin", Attribute::kUndefined},
    {"lOction", Attribute::kUndefined},
    {"muHH_Tse", Attribute::kUndefined},
    {"muSSO66use", Attribute::kUndefined},
    {"TTYYdd_use", Attribute::kUndefined},
    {"sgiz", Attribute::kUndefined},
    {"sizGG", Attribute::kUndefined},
    {"lliOQI", Attribute::kUndefined},
    {"sbgroup_size", Attribute::kUndefined},
    {"surrgroup_size", Attribute::kUndefined},
    {"subgro7_syyze", Attribute::kUndefined},
    {"YBB22Wex", Attribute::kUndefined},
    {"yyerteV", Attribute::kUndefined},
    {"re4", Attribute::kUndefined},
    {"ddorkgroup_size", Attribute::kUndefined},
    {"wzrVVroup_size", Attribute::kUndefined},
    {"workgroup_siyye", 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
