blob: 98b75d5ee72afea31b303865390f0652233b6fcb [file]
// Copyright 2025 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
////////////////////////////////////////////////////////////////////////////////
// File generated by 'tools/src/cmd/gen' using the template:
// src/tint/lang/core/enums_test.cc.tmpl
//
// To regenerate run: './tools/run gen'
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/lang/core/enums.h"
#include <gtest/gtest.h>
#include <string>
#include "src/tint/utils/text/string.h"
namespace tint::core {
namespace {
namespace parse_print_tests {
struct AccessCase {
const char* string;
Access value;
};
inline std::ostream& operator<<(std::ostream& out, AccessCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr AccessCase kValidAccessCases[] = {
{"read", Access::kRead},
{"read_write", Access::kReadWrite},
{"write", Access::kWrite},
};
static constexpr AccessCase kInvalidAccessCases[] = {
{"ccad", Access::kUndefined}, {"3", Access::kUndefined},
{"rVad", Access::kUndefined}, {"read1write", Access::kUndefined},
{"reaJqqrite", Access::kUndefined}, {"rea7ll_write", Access::kUndefined},
{"wrqHtpp", Access::kUndefined}, {"ve", Access::kUndefined},
{"Grbe", Access::kUndefined},
};
using AccessParseTest = testing::TestWithParam<AccessCase>;
TEST_P(AccessParseTest, Parse) {
const char* string = GetParam().string;
Access expect = GetParam().value;
EXPECT_EQ(expect, ParseAccess(string));
}
INSTANTIATE_TEST_SUITE_P(ValidAccessCases, AccessParseTest, testing::ValuesIn(kValidAccessCases));
INSTANTIATE_TEST_SUITE_P(InvalidAccessCases,
AccessParseTest,
testing::ValuesIn(kInvalidAccessCases));
using AccessPrintTest = testing::TestWithParam<AccessCase>;
TEST_P(AccessPrintTest, Print) {
Access value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidAccessCases, AccessPrintTest, testing::ValuesIn(kValidAccessCases));
} // namespace parse_print_tests
namespace parse_print_tests {
struct AddressSpaceCase {
const char* string;
AddressSpace value;
};
inline std::ostream& operator<<(std::ostream& out, AddressSpaceCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr AddressSpaceCase kValidAddressSpaceCases[] = {
{"function", AddressSpace::kFunction}, {"immediate", AddressSpace::kImmediate},
{"pixel_local", AddressSpace::kPixelLocal}, {"private", AddressSpace::kPrivate},
{"storage", AddressSpace::kStorage}, {"uniform", AddressSpace::kUniform},
{"workgroup", AddressSpace::kWorkgroup},
};
static constexpr AddressSpaceCase kInvalidAddressSpaceCases[] = {
{"fuviition", AddressSpace::kUndefined}, {"fuWWcti8n", AddressSpace::kUndefined},
{"fxxcMion", AddressSpace::kUndefined}, {"iXediggte", AddressSpace::kUndefined},
{"immXVue", AddressSpace::kUndefined}, {"3mmediate", AddressSpace::kUndefined},
{"pixel_locaE", AddressSpace::kUndefined}, {"piTTel_locPl", AddressSpace::kUndefined},
{"pxxdxel_loal", AddressSpace::kUndefined}, {"p44ivate", AddressSpace::kUndefined},
{"prSSvaVVe", AddressSpace::kUndefined}, {"RriR22e", AddressSpace::kUndefined},
{"sFra9e", AddressSpace::kUndefined}, {"stoage", AddressSpace::kUndefined},
{"VOORRHge", AddressSpace::kUndefined}, {"unfoym", AddressSpace::kUndefined},
{"llnnrrf77rm", AddressSpace::kUndefined}, {"unif4r00", AddressSpace::kUndefined},
{"wooogup", AddressSpace::kUndefined}, {"wozzgrop", AddressSpace::kUndefined},
{"o11pkgriiu", AddressSpace::kUndefined},
};
using AddressSpaceParseTest = testing::TestWithParam<AddressSpaceCase>;
TEST_P(AddressSpaceParseTest, Parse) {
const char* string = GetParam().string;
AddressSpace expect = GetParam().value;
EXPECT_EQ(expect, ParseAddressSpace(string));
}
INSTANTIATE_TEST_SUITE_P(ValidAddressSpaceCases,
AddressSpaceParseTest,
testing::ValuesIn(kValidAddressSpaceCases));
INSTANTIATE_TEST_SUITE_P(InvalidAddressSpaceCases,
AddressSpaceParseTest,
testing::ValuesIn(kInvalidAddressSpaceCases));
using AddressSpacePrintTest = testing::TestWithParam<AddressSpaceCase>;
TEST_P(AddressSpacePrintTest, Print) {
AddressSpace value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidAddressSpaceCases,
AddressSpacePrintTest,
testing::ValuesIn(kValidAddressSpaceCases));
} // namespace parse_print_tests
namespace interpolation_sampling_tests {
namespace parse_print_tests {
struct InterpolationSamplingCase {
const char* string;
InterpolationSampling value;
};
inline std::ostream& operator<<(std::ostream& out, InterpolationSamplingCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr InterpolationSamplingCase kValidInterpolationSamplingCases[] = {
{"center", InterpolationSampling::kCenter}, {"centroid", InterpolationSampling::kCentroid},
{"either", InterpolationSampling::kEither}, {"first", InterpolationSampling::kFirst},
{"sample", InterpolationSampling::kSample},
};
static constexpr InterpolationSamplingCase kInvalidInterpolationSamplingCases[] = {
{"ceXXter", InterpolationSampling::kUndefined},
{"55IIntnn99", InterpolationSampling::kUndefined},
{"aHHrrnteSS", InterpolationSampling::kUndefined},
{"ckknod", InterpolationSampling::kUndefined},
{"gjnrRRi", InterpolationSampling::kUndefined},
{"cnbrid", InterpolationSampling::kUndefined},
{"eithjr", InterpolationSampling::kUndefined},
{"ether", InterpolationSampling::kUndefined},
{"ehqr", InterpolationSampling::kUndefined},
{"Nirst", InterpolationSampling::kUndefined},
{"frvv", InterpolationSampling::kUndefined},
{"fisQQ", InterpolationSampling::kUndefined},
{"aplrf", InterpolationSampling::kUndefined},
{"sampje", InterpolationSampling::kUndefined},
{"s82wNNe", InterpolationSampling::kUndefined},
};
using InterpolationSamplingParseTest = testing::TestWithParam<InterpolationSamplingCase>;
TEST_P(InterpolationSamplingParseTest, Parse) {
const char* string = GetParam().string;
InterpolationSampling expect = GetParam().value;
EXPECT_EQ(expect, ParseInterpolationSampling(string));
}
INSTANTIATE_TEST_SUITE_P(ValidInterpolationSamplingCases,
InterpolationSamplingParseTest,
testing::ValuesIn(kValidInterpolationSamplingCases));
INSTANTIATE_TEST_SUITE_P(InvalidInterpolationSamplingCases,
InterpolationSamplingParseTest,
testing::ValuesIn(kInvalidInterpolationSamplingCases));
using InterpolationSamplingPrintTest = testing::TestWithParam<InterpolationSamplingCase>;
TEST_P(InterpolationSamplingPrintTest, Print) {
InterpolationSampling value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidInterpolationSamplingCases,
InterpolationSamplingPrintTest,
testing::ValuesIn(kValidInterpolationSamplingCases));
} // namespace parse_print_tests
} // namespace interpolation_sampling_tests
namespace interpolation_type_tests {
namespace parse_print_tests {
struct InterpolationTypeCase {
const char* string;
InterpolationType value;
};
inline std::ostream& operator<<(std::ostream& out, InterpolationTypeCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr InterpolationTypeCase kValidInterpolationTypeCases[] = {
{"flat", InterpolationType::kFlat},
{"linear", InterpolationType::kLinear},
{"perspective", InterpolationType::kPerspective},
};
static constexpr InterpolationTypeCase kInvalidInterpolationTypeCases[] = {
{"fat", InterpolationType::kUndefined}, {"flrrt", InterpolationType::kUndefined},
{"fGat", InterpolationType::kUndefined}, {"linFFar", InterpolationType::kUndefined},
{"lna", InterpolationType::kUndefined}, {"lrrnea", InterpolationType::kUndefined},
{"persetive", InterpolationType::kUndefined}, {"XrspJJcDive", InterpolationType::kUndefined},
{"pesect8v", InterpolationType::kUndefined},
};
using InterpolationTypeParseTest = testing::TestWithParam<InterpolationTypeCase>;
TEST_P(InterpolationTypeParseTest, Parse) {
const char* string = GetParam().string;
InterpolationType expect = GetParam().value;
EXPECT_EQ(expect, ParseInterpolationType(string));
}
INSTANTIATE_TEST_SUITE_P(ValidInterpolationTypeCases,
InterpolationTypeParseTest,
testing::ValuesIn(kValidInterpolationTypeCases));
INSTANTIATE_TEST_SUITE_P(InvalidInterpolationTypeCases,
InterpolationTypeParseTest,
testing::ValuesIn(kInvalidInterpolationTypeCases));
using InterpolationTypePrintTest = testing::TestWithParam<InterpolationTypeCase>;
TEST_P(InterpolationTypePrintTest, Print) {
InterpolationType value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidInterpolationTypeCases,
InterpolationTypePrintTest,
testing::ValuesIn(kValidInterpolationTypeCases));
} // namespace parse_print_tests
} // namespace interpolation_type_tests
namespace parse_print_tests {
struct TexelFormatCase {
const char* string;
TexelFormat value;
};
inline std::ostream& operator<<(std::ostream& out, TexelFormatCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr TexelFormatCase kValidTexelFormatCases[] = {
{"bgra8unorm", TexelFormat::kBgra8Unorm}, {"r16float", TexelFormat::kR16Float},
{"r16sint", TexelFormat::kR16Sint}, {"r16uint", TexelFormat::kR16Uint},
{"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},
{"rg16uint", TexelFormat::kRg16Uint}, {"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},
{"rgba16uint", TexelFormat::kRgba16Uint}, {"rgba32float", TexelFormat::kRgba32Float},
{"rgba32sint", TexelFormat::kRgba32Sint}, {"rgba32uint", TexelFormat::kRgba32Uint},
{"rgba8sint", TexelFormat::kRgba8Sint}, {"rgba8snorm", TexelFormat::kRgba8Snorm},
{"rgba8uint", TexelFormat::kRgba8Uint}, {"rgba8unorm", TexelFormat::kRgba8Unorm},
};
static constexpr TexelFormatCase kInvalidTexelFormatCases[] = {
{"bg811kor", TexelFormat::kUndefined},
{"bgr8unorm", TexelFormat::kUndefined},
{"bgJa8unom", TexelFormat::kUndefined},
{"r16fcoat", TexelFormat::kUndefined},
{"r16floOt", TexelFormat::kUndefined},
{"r16floKK_vtt", TexelFormat::kUndefined},
{"xx8sint", TexelFormat::kUndefined},
{"__q16Fn", TexelFormat::kUndefined},
{"r16qint", TexelFormat::kUndefined},
{"3316Oint", TexelFormat::kUndefined},
{"rtt6ui9oQQ", TexelFormat::kUndefined},
{"r1ui66t", TexelFormat::kUndefined},
{"rOxflo6zz", TexelFormat::kUndefined},
{"r32yyloat", TexelFormat::kUndefined},
{"rHHloat", TexelFormat::kUndefined},
{"4WW2sqnt", TexelFormat::kUndefined},
{"rOOsint", TexelFormat::kUndefined},
{"o32Ynt", TexelFormat::kUndefined},
{"r32i", TexelFormat::kUndefined},
{"r3uiFt", TexelFormat::kUndefined},
{"32uinw", TexelFormat::kUndefined},
{"r8iGf", TexelFormat::kUndefined},
{"q8sKKnt", TexelFormat::kUndefined},
{"rmmsint", TexelFormat::kUndefined},
{"8snorm", TexelFormat::kUndefined},
{"rsnorq", TexelFormat::kUndefined},
{"r8snobb", TexelFormat::kUndefined},
{"iuint", TexelFormat::kUndefined},
{"rOOinq", TexelFormat::kUndefined},
{"r8uiTvvt", TexelFormat::kUndefined},
{"r8FFnorm", TexelFormat::kUndefined},
{"P800oQm", TexelFormat::kUndefined},
{"rPunorm", TexelFormat::kUndefined},
{"r177sb10ufloat", TexelFormat::kUndefined},
{"rgC1b10uflRRabb", TexelFormat::kUndefined},
{"rg11b10uflXXat", TexelFormat::kUndefined},
{"qgCCOOfoOOt", TexelFormat::kUndefined},
{"rs6uloaL", TexelFormat::kUndefined},
{"rgX6float", TexelFormat::kUndefined},
{"rg16snt", TexelFormat::kUndefined},
{"gqqsnt", TexelFormat::kUndefined},
{"rg16s22nt", TexelFormat::kUndefined},
{"rg1zzXuiy", TexelFormat::kUndefined},
{"rg1iPint", TexelFormat::kUndefined},
{"rnn16Cnt", TexelFormat::kUndefined},
{"3qqAAloaHH", TexelFormat::kUndefined},
{"rg32flat", TexelFormat::kUndefined},
{"rg3floKf", TexelFormat::kUndefined},
{"rgP2ggi", TexelFormat::kUndefined},
{"rg3sint", TexelFormat::kUndefined},
{"TTg32N4nc", TexelFormat::kUndefined},
{"pgl2uin77", TexelFormat::kUndefined},
{"rz3Ngint", TexelFormat::kUndefined},
{"bg32uXXut", TexelFormat::kUndefined},
{"rg8int", TexelFormat::kUndefined},
{"Q888nt", TexelFormat::kUndefined},
{"r89qnt", TexelFormat::kUndefined},
{"rg11snorm", TexelFormat::kUndefined},
{"rg822oFii", TexelFormat::kUndefined},
{"rg8sn7rm", TexelFormat::kUndefined},
{"r28uiNt", TexelFormat::kUndefined},
{"rVV8uint", TexelFormat::kUndefined},
{"FgWWuw11t", TexelFormat::kUndefined},
{"rww8unor", TexelFormat::kUndefined},
{"rg8unoDm", TexelFormat::kUndefined},
{"rg8uorK", TexelFormat::kUndefined},
{"rfh10PP11urnt", TexelFormat::kUndefined},
{"rgb10a2int", TexelFormat::kUndefined},
{"rgb10YY2uint", TexelFormat::kUndefined},
{"rgb10aunkkrtH", TexelFormat::kUndefined},
{"rgbrr0a2unorm", TexelFormat::kUndefined},
{"rssb10aWWunom", TexelFormat::kUndefined},
{"rgYa16floa", TexelFormat::kUndefined},
{"rqba1Llfat", TexelFormat::kUndefined},
{"rgvva122uflat", TexelFormat::kUndefined},
{"ba16sint", TexelFormat::kUndefined},
{"rgba6sint", TexelFormat::kUndefined},
{"rgba77EsyYnt", TexelFormat::kUndefined},
{"rgMaoo6udt", TexelFormat::kUndefined},
{"rgbMM16unt", TexelFormat::kUndefined},
{"rgba155uint", TexelFormat::kUndefined},
{"gba32fNot", TexelFormat::kUndefined},
{"rgb332flo3t", TexelFormat::kUndefined},
{"rgba32flo3t", TexelFormat::kUndefined},
{"rgma32siI", TexelFormat::kUndefined},
{"rrba32snKnt", TexelFormat::kUndefined},
{"ra32sXt", TexelFormat::kUndefined},
{"Iga3pLLint", TexelFormat::kUndefined},
{"fb32uint", TexelFormat::kUndefined},
{"UgbRRDuinY", TexelFormat::kUndefined},
{"rgha8sint", TexelFormat::kUndefined},
{"uuqIb8int", TexelFormat::kUndefined},
{"rgHa8sint", TexelFormat::kUndefined},
{"gbaQQvvorm", TexelFormat::kUndefined},
{"66a8snerm", TexelFormat::kUndefined},
{"rW7a8snor", TexelFormat::kUndefined},
{"05gDDa8uint", TexelFormat::kUndefined},
{"rgHII8uint", TexelFormat::kUndefined},
{"rgba8int", TexelFormat::kUndefined},
{"rgba8rnor", TexelFormat::kUndefined},
{"rgba8lnorm", TexelFormat::kUndefined},
{"ttgJJa8uGm", TexelFormat::kUndefined},
};
using TexelFormatParseTest = testing::TestWithParam<TexelFormatCase>;
TEST_P(TexelFormatParseTest, Parse) {
const char* string = GetParam().string;
TexelFormat expect = GetParam().value;
EXPECT_EQ(expect, ParseTexelFormat(string));
}
INSTANTIATE_TEST_SUITE_P(ValidTexelFormatCases,
TexelFormatParseTest,
testing::ValuesIn(kValidTexelFormatCases));
INSTANTIATE_TEST_SUITE_P(InvalidTexelFormatCases,
TexelFormatParseTest,
testing::ValuesIn(kInvalidTexelFormatCases));
using TexelFormatPrintTest = testing::TestWithParam<TexelFormatCase>;
TEST_P(TexelFormatPrintTest, Print) {
TexelFormat value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidTexelFormatCases,
TexelFormatPrintTest,
testing::ValuesIn(kValidTexelFormatCases));
} // namespace parse_print_tests
namespace parse_print_tests {
struct BuiltinTypeCase {
const char* string;
BuiltinType value;
};
inline std::ostream& operator<<(std::ostream& out, BuiltinTypeCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr BuiltinTypeCase kValidBuiltinTypeCases[] = {
{"__atomic_compare_exchange_result_i32", BuiltinType::kAtomicCompareExchangeResultI32},
{"__atomic_compare_exchange_result_u32", BuiltinType::kAtomicCompareExchangeResultU32},
{"__frexp_result_abstract", BuiltinType::kFrexpResultAbstract},
{"__frexp_result_f16", BuiltinType::kFrexpResultF16},
{"__frexp_result_f32", BuiltinType::kFrexpResultF32},
{"__frexp_result_vec2_abstract", BuiltinType::kFrexpResultVec2Abstract},
{"__frexp_result_vec2_f16", BuiltinType::kFrexpResultVec2F16},
{"__frexp_result_vec2_f32", BuiltinType::kFrexpResultVec2F32},
{"__frexp_result_vec3_abstract", BuiltinType::kFrexpResultVec3Abstract},
{"__frexp_result_vec3_f16", BuiltinType::kFrexpResultVec3F16},
{"__frexp_result_vec3_f32", BuiltinType::kFrexpResultVec3F32},
{"__frexp_result_vec4_abstract", BuiltinType::kFrexpResultVec4Abstract},
{"__frexp_result_vec4_f16", BuiltinType::kFrexpResultVec4F16},
{"__frexp_result_vec4_f32", BuiltinType::kFrexpResultVec4F32},
{"__modf_result_abstract", BuiltinType::kModfResultAbstract},
{"__modf_result_f16", BuiltinType::kModfResultF16},
{"__modf_result_f32", BuiltinType::kModfResultF32},
{"__modf_result_vec2_abstract", BuiltinType::kModfResultVec2Abstract},
{"__modf_result_vec2_f16", BuiltinType::kModfResultVec2F16},
{"__modf_result_vec2_f32", BuiltinType::kModfResultVec2F32},
{"__modf_result_vec3_abstract", BuiltinType::kModfResultVec3Abstract},
{"__modf_result_vec3_f16", BuiltinType::kModfResultVec3F16},
{"__modf_result_vec3_f32", BuiltinType::kModfResultVec3F32},
{"__modf_result_vec4_abstract", BuiltinType::kModfResultVec4Abstract},
{"__modf_result_vec4_f16", BuiltinType::kModfResultVec4F16},
{"__modf_result_vec4_f32", BuiltinType::kModfResultVec4F32},
{"array", BuiltinType::kArray},
{"atomic", BuiltinType::kAtomic},
{"binding_array", BuiltinType::kBindingArray},
{"bool", BuiltinType::kBool},
{"f16", BuiltinType::kF16},
{"f32", BuiltinType::kF32},
{"i32", BuiltinType::kI32},
{"i8", BuiltinType::kI8},
{"input_attachment", BuiltinType::kInputAttachment},
{"mat2x2", BuiltinType::kMat2X2},
{"mat2x2f", BuiltinType::kMat2X2F},
{"mat2x2h", BuiltinType::kMat2X2H},
{"mat2x3", BuiltinType::kMat2X3},
{"mat2x3f", BuiltinType::kMat2X3F},
{"mat2x3h", BuiltinType::kMat2X3H},
{"mat2x4", BuiltinType::kMat2X4},
{"mat2x4f", BuiltinType::kMat2X4F},
{"mat2x4h", BuiltinType::kMat2X4H},
{"mat3x2", BuiltinType::kMat3X2},
{"mat3x2f", BuiltinType::kMat3X2F},
{"mat3x2h", BuiltinType::kMat3X2H},
{"mat3x3", BuiltinType::kMat3X3},
{"mat3x3f", BuiltinType::kMat3X3F},
{"mat3x3h", BuiltinType::kMat3X3H},
{"mat3x4", BuiltinType::kMat3X4},
{"mat3x4f", BuiltinType::kMat3X4F},
{"mat3x4h", BuiltinType::kMat3X4H},
{"mat4x2", BuiltinType::kMat4X2},
{"mat4x2f", BuiltinType::kMat4X2F},
{"mat4x2h", BuiltinType::kMat4X2H},
{"mat4x3", BuiltinType::kMat4X3},
{"mat4x3f", BuiltinType::kMat4X3F},
{"mat4x3h", BuiltinType::kMat4X3H},
{"mat4x4", BuiltinType::kMat4X4},
{"mat4x4f", BuiltinType::kMat4X4F},
{"mat4x4h", BuiltinType::kMat4X4H},
{"ptr", BuiltinType::kPtr},
{"sampler", BuiltinType::kSampler},
{"sampler_comparison", BuiltinType::kSamplerComparison},
{"subgroup_matrix_left", BuiltinType::kSubgroupMatrixLeft},
{"subgroup_matrix_result", BuiltinType::kSubgroupMatrixResult},
{"subgroup_matrix_right", BuiltinType::kSubgroupMatrixRight},
{"texture_1d", BuiltinType::kTexture1D},
{"texture_2d", BuiltinType::kTexture2D},
{"texture_2d_array", BuiltinType::kTexture2DArray},
{"texture_3d", BuiltinType::kTexture3D},
{"texture_cube", BuiltinType::kTextureCube},
{"texture_cube_array", BuiltinType::kTextureCubeArray},
{"texture_depth_2d", BuiltinType::kTextureDepth2D},
{"texture_depth_2d_array", BuiltinType::kTextureDepth2DArray},
{"texture_depth_cube", BuiltinType::kTextureDepthCube},
{"texture_depth_cube_array", BuiltinType::kTextureDepthCubeArray},
{"texture_depth_multisampled_2d", BuiltinType::kTextureDepthMultisampled2D},
{"texture_external", BuiltinType::kTextureExternal},
{"texture_multisampled_2d", BuiltinType::kTextureMultisampled2D},
{"texture_storage_1d", BuiltinType::kTextureStorage1D},
{"texture_storage_2d", BuiltinType::kTextureStorage2D},
{"texture_storage_2d_array", BuiltinType::kTextureStorage2DArray},
{"texture_storage_3d", BuiltinType::kTextureStorage3D},
{"u32", BuiltinType::kU32},
{"u8", BuiltinType::kU8},
{"vec2", BuiltinType::kVec2},
{"vec2f", BuiltinType::kVec2F},
{"vec2h", BuiltinType::kVec2H},
{"vec2i", BuiltinType::kVec2I},
{"vec2u", BuiltinType::kVec2U},
{"vec3", BuiltinType::kVec3},
{"vec3f", BuiltinType::kVec3F},
{"vec3h", BuiltinType::kVec3H},
{"vec3i", BuiltinType::kVec3I},
{"vec3u", BuiltinType::kVec3U},
{"vec4", BuiltinType::kVec4},
{"vec4f", BuiltinType::kVec4F},
{"vec4h", BuiltinType::kVec4H},
{"vec4i", BuiltinType::kVec4I},
{"vec4u", BuiltinType::kVec4U},
};
static constexpr BuiltinTypeCase kInvalidBuiltinTypeCases[] = {
{"y_atomic_compar_exchange_result_i32", BuiltinType::kUndefined},
{"__atomi_compare_exchange_result_i32", BuiltinType::kUndefined},
{"BB_atomicIIcompare_exchange_result_i32", BuiltinType::kUndefined},
{"__atomic_compar_exchaTTge_reKult_33832", BuiltinType::kUndefined},
{"__addoUUic_compareYYexchange_resnnlSS_u32", BuiltinType::kUndefined},
{"d_atomic_comCCare_exchange_5eZult_u32", BuiltinType::kUndefined},
{"__kkrqxp_result_abstract", BuiltinType::kUndefined},
{"__fr5xp_resul00i_abstpat", BuiltinType::kUndefined},
{"__IIrexp_resunnt_abstract", BuiltinType::kUndefined},
{"__KreW_rccsult_f1", BuiltinType::kUndefined},
{"_fKKexpreult_f16", BuiltinType::kUndefined},
{"__frexp_66esult_f16", BuiltinType::kUndefined},
{"__fKPPex_reslE_f32", BuiltinType::kUndefined},
{"__xrexp_result_f32", BuiltinType::kUndefined},
{"__fqexp_result_f32", BuiltinType::kUndefined},
{"_SMMfrexp_ryrslt_vec2_abstract", BuiltinType::kUndefined},
{"__fxp_reuult_vec2_abstract", BuiltinType::kUndefined},
{"__frexp_Sesult_ec2_absrct", BuiltinType::kUndefined},
{"__frexp_result_vec5FFf16", BuiltinType::kUndefined},
{"__frexp_res44lt_zec2_rr16", BuiltinType::kUndefined},
{"__fWWexp_reul_ve2_f16", BuiltinType::kUndefined},
{"_Xfrexp_resuJJt_vec2_fZZ2", BuiltinType::kUndefined},
{"__frexp_PPsult_vec2_f32", BuiltinType::kUndefined},
{"__frexp_result_vecc_f32", BuiltinType::kUndefined},
{"__6rexp_resultllvec3_abstPPact", BuiltinType::kUndefined},
{"__f99exp_result_yyec3_abstact", BuiltinType::kUndefined},
{"__freKKp_result_vec3_abstrJct", BuiltinType::kUndefined},
{"__frexp_reult_vec3_fx6", BuiltinType::kUndefined},
{"__fexp_esulK_vec3yyf6", BuiltinType::kUndefined},
{"__frexp_resulV_vekz_f16", BuiltinType::kUndefined},
{"__freqp_rKsult_vec3_f32", BuiltinType::kUndefined},
{"__rexp_result_vec3_f32", BuiltinType::kUndefined},
{"__frexpresult_vec3_VV32", BuiltinType::kUndefined},
{"__frexpAAreIult_veU4_abstract", BuiltinType::kUndefined},
{"__jrexp_rRult_vec4_abtract", BuiltinType::kUndefined},
{"_frexpres44l_vec4_abstrYYct", BuiltinType::kUndefined},
{"__frexp_result_ve4_f16", BuiltinType::kUndefined},
{"__frexxp_rsult_ve11_f19", BuiltinType::kUndefined},
{"__frexcc_msult_vec4_f1J", BuiltinType::kUndefined},
{"__frexp_reult_vec4_f3JJ", BuiltinType::kUndefined},
{"__fCCUxp_result_fecDD_f32", BuiltinType::kUndefined},
{"__frgxp_result_vec4_f32", BuiltinType::kUndefined},
{"__modfCCeult_abstact", BuiltinType::kUndefined},
{"__modf_result_astract", BuiltinType::kUndefined},
{"__modf___esult_absIract", BuiltinType::kUndefined},
{"__mttN_rPPsultf16", BuiltinType::kUndefined},
{"_3modf_rddsult_f16", BuiltinType::kUndefined},
{"K_yyodf_resultf16", BuiltinType::kUndefined},
{"__mud_rslt_f32", BuiltinType::kUndefined},
{"_3modf_nnesult_i02", BuiltinType::kUndefined},
{"K_modv_CCenuluu_f32", BuiltinType::kUndefined},
{"__modf_reuXt_vec2llabstract", BuiltinType::kUndefined},
{"pp_modf_resuot_vec2_abstract", BuiltinType::kUndefined},
{"__modf_result_vecw_abstract", BuiltinType::kUndefined},
{"__modf_reult_uumec2gf1", BuiltinType::kUndefined},
{"__mmmf_resultaave2_16", BuiltinType::kUndefined},
{"__modf_rRRsult_TecccZf16", BuiltinType::kUndefined},
{"__mo88f_resultTOec2_f32", BuiltinType::kUndefined},
{"__modm_r00sult_vec2_f32", BuiltinType::kUndefined},
{"__modfmresult_BBec2_f32", BuiltinType::kUndefined},
{"__odf_result_ppec_absMract", BuiltinType::kUndefined},
{"__mOOdf_result_ec3_abstract", BuiltinType::kUndefined},
{"__modf_esult_vec3_absGGGact", BuiltinType::kUndefined},
{"__modf11result_vHHc3_f16", BuiltinType::kUndefined},
{"__mFFdf_resu6et_vec_f16", BuiltinType::kUndefined},
{"_modf_resut_vec3_f16", BuiltinType::kUndefined},
{"__modf_result_vKii3_f32", BuiltinType::kUndefined},
{"__modf_rsult_vec3_f32", BuiltinType::kUndefined},
{"__mov99_result_veII3_f32", BuiltinType::kUndefined},
{"__odf_result_vec4_abstract", BuiltinType::kUndefined},
{"__modf_result_vec4habstract", BuiltinType::kUndefined},
{"__modf_resulzllP_vec4_absract", BuiltinType::kUndefined},
{"__mod_eslt_vec4f16", BuiltinType::kUndefined},
{"__modf_ffesult_qqec4f16", BuiltinType::kUndefined},
{"W_mdf_resuldd_veJJ4_f16", BuiltinType::kUndefined},
{"__mXXdf_result_vzz_f3r", BuiltinType::kUndefined},
{"__modf_result_2ec4_32", BuiltinType::kUndefined},
{"__modf_rNsult_veyy4_f32", BuiltinType::kUndefined},
{"aOa", BuiltinType::kUndefined},
{"PEruZ", BuiltinType::kUndefined},
{"alr2edd", BuiltinType::kUndefined},
{"mtV9m", BuiltinType::kUndefined},
{"atImi1", BuiltinType::kUndefined},
{"atbmic", BuiltinType::kUndefined},
{"bndng_ari7y", BuiltinType::kUndefined},
{"binding_aroiiy", BuiltinType::kUndefined},
{"nining_ara5", BuiltinType::kUndefined},
{"boS", BuiltinType::kUndefined},
{"o22", BuiltinType::kUndefined},
{"1oCl", BuiltinType::kUndefined},
{"f816", BuiltinType::kUndefined},
{"6", BuiltinType::kUndefined},
{"JJ1SS", BuiltinType::kUndefined},
{"9", BuiltinType::kUndefined},
{"TT3JJb", BuiltinType::kUndefined},
{"66", BuiltinType::kUndefined},
{"u66", BuiltinType::kUndefined},
{"yW", BuiltinType::kUndefined},
{"i", BuiltinType::kUndefined},
{"8", BuiltinType::kUndefined},
{"r8", BuiltinType::kUndefined},
{"iB", BuiltinType::kUndefined},
{"input_attcBBment", BuiltinType::kUndefined},
{"input_attchmeRRt", BuiltinType::kUndefined},
{"iLL0Vt_attahment", BuiltinType::kUndefined},
{"at2KOO", BuiltinType::kUndefined},
{"awg2x2", BuiltinType::kUndefined},
{"maLhhp", BuiltinType::kUndefined},
{"aKii2xf", BuiltinType::kUndefined},
{"ma2x2f", BuiltinType::kUndefined},
{"UUa2882", BuiltinType::kUndefined},
{"rrvvt2x2h", BuiltinType::kUndefined},
{"m2xwmm", BuiltinType::kUndefined},
{"j442x2h", BuiltinType::kUndefined},
{"matXx3", BuiltinType::kUndefined},
{"m8t2x3", BuiltinType::kUndefined},
{"mat2vEE", BuiltinType::kUndefined},
{"mai92zz", BuiltinType::kUndefined},
{"mQQJJnxGGf", BuiltinType::kUndefined},
{"mass2x3f", BuiltinType::kUndefined},
{"matKxPh", BuiltinType::kUndefined},
{"mat2tth", BuiltinType::kUndefined},
{"mt2x3", BuiltinType::kUndefined},
{"maMM2x4", BuiltinType::kUndefined},
{"mJ0t2x4", BuiltinType::kUndefined},
{"V28", BuiltinType::kUndefined},
{"maKggx4hh", BuiltinType::kUndefined},
{"maf2x4f", BuiltinType::kUndefined},
{"matQ7x4f", BuiltinType::kUndefined},
{"mat2YYh", BuiltinType::kUndefined},
{"mak2x4", BuiltinType::kUndefined},
{"man2x2", BuiltinType::kUndefined},
{"mFFx2", BuiltinType::kUndefined},
{"GGatPPuUU", BuiltinType::kUndefined},
{"mEEFa2", BuiltinType::kUndefined},
{"ddtBBDDef", BuiltinType::kUndefined},
{"m55tMccE2", BuiltinType::kUndefined},
{"aKKx2", BuiltinType::kUndefined},
{"mat3x2R", BuiltinType::kUndefined},
{"maDx29", BuiltinType::kUndefined},
{"mt3x2h", BuiltinType::kUndefined},
{"aIt33", BuiltinType::kUndefined},
{"mat3x77", BuiltinType::kUndefined},
{"matIx3", BuiltinType::kUndefined},
{"md3x3f", BuiltinType::kUndefined},
{"mat33f", BuiltinType::kUndefined},
{"mtt3f", BuiltinType::kUndefined},
{"ma3XX3x3h", BuiltinType::kUndefined},
{"Eat33h", BuiltinType::kUndefined},
{"maXX3x3", BuiltinType::kUndefined},
{"mxBt3x4", BuiltinType::kUndefined},
{"Wt3x", BuiltinType::kUndefined},
{"mat66x4", BuiltinType::kUndefined},
{"matxv0", BuiltinType::kUndefined},
{"txf", BuiltinType::kUndefined},
{"mpt3xf", BuiltinType::kUndefined},
{"at114h", BuiltinType::kUndefined},
{"EaJ3yBBh", BuiltinType::kUndefined},
{"mqIm3x4h", BuiltinType::kUndefined},
{"ma4F2", BuiltinType::kUndefined},
{"aY4x2", BuiltinType::kUndefined},
{"matDHh2", BuiltinType::kUndefined},
{"Ht22f", BuiltinType::kUndefined},
{"matx2", BuiltinType::kUndefined},
{"matx2f", BuiltinType::kUndefined},
{"matx2h", BuiltinType::kUndefined},
{"matddx2h", BuiltinType::kUndefined},
{"Oat4x2h", BuiltinType::kUndefined},
{"bbtB3", BuiltinType::kUndefined},
{"m00tx3", BuiltinType::kUndefined},
{"hat4x3", BuiltinType::kUndefined},
{"mgYtx3f", BuiltinType::kUndefined},
{"mat4O3f", BuiltinType::kUndefined},
{"ah4xf", BuiltinType::kUndefined},
{"fpaEEx3h", BuiltinType::kUndefined},
{"mavx3h", BuiltinType::kUndefined},
{"mzztx3h", BuiltinType::kUndefined},
{"mat4x", BuiltinType::kUndefined},
{"OiiJt4", BuiltinType::kUndefined},
{"mGt4xf", BuiltinType::kUndefined},
{"mat4x422T", BuiltinType::kUndefined},
{"datlx4f", BuiltinType::kUndefined},
{"bat4x4f", BuiltinType::kUndefined},
{"BBatx4h", BuiltinType::kUndefined},
{"PPIXt4S4h", BuiltinType::kUndefined},
{"mjjt4x4h", BuiltinType::kUndefined},
{"p_cc", BuiltinType::kUndefined},
{"6Szzx", BuiltinType::kUndefined},
{"", BuiltinType::kUndefined},
{"sx4pNev", BuiltinType::kUndefined},
{"amAAl00p", BuiltinType::kUndefined},
{"eeymyr", BuiltinType::kUndefined},
{"samWWler_comparisbn", BuiltinType::kUndefined},
{"sammlerMMcottparison", BuiltinType::kUndefined},
{"ampldr_comarson", BuiltinType::kUndefined},
{"subgrovp_matrix_lef", BuiltinType::kUndefined},
{"sEEbgroup_matrixVleft", BuiltinType::kUndefined},
{"subgroup_matrix_lef4", BuiltinType::kUndefined},
{"subVVroup_matrgX_result", BuiltinType::kUndefined},
{"Vubgroup_motrix_result", BuiltinType::kUndefined},
{"subgroup_matrix_reslt", BuiltinType::kUndefined},
{"subgrouKK_mtrix_right", BuiltinType::kUndefined},
{"subgGoup_atrix_rgh", BuiltinType::kUndefined},
{"sabgrop_matrix_right", BuiltinType::kUndefined},
{"txtuNOO1d", BuiltinType::kUndefined},
{"ttGre_1", BuiltinType::kUndefined},
{"textur5_1d", BuiltinType::kUndefined},
{"99jffture_2d", BuiltinType::kUndefined},
{"texRurevY2XX", BuiltinType::kUndefined},
{"exurc_2d", BuiltinType::kUndefined},
{"txu5e_288XXarray", BuiltinType::kUndefined},
{"texure_2_array", BuiltinType::kUndefined},
{"texture_2d_arppcy", BuiltinType::kUndefined},
{"texvure_3d", BuiltinType::kUndefined},
{"tEExtSSe_Jd", BuiltinType::kUndefined},
{"texture3", BuiltinType::kUndefined},
{"tex_ure_u", BuiltinType::kUndefined},
{"tewture__ube", BuiltinType::kUndefined},
{"textured99cube", BuiltinType::kUndefined},
{"exture_u99e_PPrray", BuiltinType::kUndefined},
{"tetureKKcube_array", BuiltinType::kUndefined},
{"teMture_oubDD_array", BuiltinType::kUndefined},
{"eiBture_ept_2d", BuiltinType::kUndefined},
{"txturedepthq2d", BuiltinType::kUndefined},
{"00extureLdeph_2d", BuiltinType::kUndefined},
{"texnuvve_d66pth_2d_array", BuiltinType::kUndefined},
{"texture_denh_2d_arrarr", BuiltinType::kUndefined},
{"texture_eeeph_2_arxxay", BuiltinType::kUndefined},
{"tONNture_depth_CCube", BuiltinType::kUndefined},
{"txture_depth_cube", BuiltinType::kUndefined},
{"t4xtureadepth_cube", BuiltinType::kUndefined},
{"texturNN_depth_cuNNe_arry", BuiltinType::kUndefined},
{"texture_depth_cbe_array", BuiltinType::kUndefined},
{"tuxturedeph_cube_array", BuiltinType::kUndefined},
{"teAture_depth_multisaSpEEedYYd", BuiltinType::kUndefined},
{"t0xture_depth_multisampled_2d", BuiltinType::kUndefined},
{"texture_depth_multisaampled_2d", BuiltinType::kUndefined},
{"texturmm_externa", BuiltinType::kUndefined},
{"texture_exteral", BuiltinType::kUndefined},
{"teEuUUe_exernal", BuiltinType::kUndefined},
{"texteDDKKultisampled_2d", BuiltinType::kUndefined},
{"0exture__multitampled_2d", BuiltinType::kUndefined},
{"txture_multisaAled_2d", BuiltinType::kUndefined},
{"texture_storageM1", BuiltinType::kUndefined},
{"texture_BBtorage_1d", BuiltinType::kUndefined},
{"textur99sobbagenn1d", BuiltinType::kUndefined},
{"texture_sEEoAAage12", BuiltinType::kUndefined},
{"teTture66stora5e_2d", BuiltinType::kUndefined},
{"textuHe_storage_2d", BuiltinType::kUndefined},
{"textreHHstoragexx2d_aray", BuiltinType::kUndefined},
{"texturyy_sznrage_2d_0rray", BuiltinType::kUndefined},
{"texture_strage_2d_array", BuiltinType::kUndefined},
{"texurH_ktorage_3d", BuiltinType::kUndefined},
{"exture_ctorage_3d", BuiltinType::kUndefined},
{"ooexrrre_sorage_3d", BuiltinType::kUndefined},
{"JJ", BuiltinType::kUndefined},
{"0CC", BuiltinType::kUndefined},
{"99xA", BuiltinType::kUndefined},
{"c8", BuiltinType::kUndefined},
{"S8", BuiltinType::kUndefined},
{"uB", BuiltinType::kUndefined},
{"ec2", BuiltinType::kUndefined},
{"vcme", BuiltinType::kUndefined},
{"voPPQQ", BuiltinType::kUndefined},
{"B", BuiltinType::kUndefined},
{"NKK2f", BuiltinType::kUndefined},
{"vrr2", BuiltinType::kUndefined},
{"ve2pr", BuiltinType::kUndefined},
{"PPecyh", BuiltinType::kUndefined},
{"vccZh", BuiltinType::kUndefined},
{"ec2", BuiltinType::kUndefined},
{"v00c2i", BuiltinType::kUndefined},
{"ecJBPss", BuiltinType::kUndefined},
{"fcffJJu", BuiltinType::kUndefined},
{"XXI2u", BuiltinType::kUndefined},
{"", BuiltinType::kUndefined},
{"vc3", BuiltinType::kUndefined},
{"vKc3", BuiltinType::kUndefined},
{"me44", BuiltinType::kUndefined},
{"veo3f", BuiltinType::kUndefined},
{"jhHHc3f", BuiltinType::kUndefined},
{"UU33Ewwf", BuiltinType::kUndefined},
{"ve3u", BuiltinType::kUndefined},
{"rddcch", BuiltinType::kUndefined},
{"2Pttch", BuiltinType::kUndefined},
{"vwwcsi", BuiltinType::kUndefined},
{"11ennci", BuiltinType::kUndefined},
{"ve3i", BuiltinType::kUndefined},
{"vecu", BuiltinType::kUndefined},
{"ecaSSIu", BuiltinType::kUndefined},
{"vED3u", BuiltinType::kUndefined},
{"cceR4", BuiltinType::kUndefined},
{"v4", BuiltinType::kUndefined},
{"vaac", BuiltinType::kUndefined},
{"LSc4f", BuiltinType::kUndefined},
{"ecmm", BuiltinType::kUndefined},
{"4ecV", BuiltinType::kUndefined},
{"vc__", BuiltinType::kUndefined},
{"vQ4", BuiltinType::kUndefined},
{"veERdd", BuiltinType::kUndefined},
{"vec9", BuiltinType::kUndefined},
{"e04", BuiltinType::kUndefined},
{"vzi", BuiltinType::kUndefined},
{"vecccu", BuiltinType::kUndefined},
{"v_Qcu", BuiltinType::kUndefined},
{"vect", BuiltinType::kUndefined},
};
using BuiltinTypeParseTest = testing::TestWithParam<BuiltinTypeCase>;
TEST_P(BuiltinTypeParseTest, Parse) {
const char* string = GetParam().string;
BuiltinType expect = GetParam().value;
EXPECT_EQ(expect, ParseBuiltinType(string));
}
INSTANTIATE_TEST_SUITE_P(ValidBuiltinTypeCases,
BuiltinTypeParseTest,
testing::ValuesIn(kValidBuiltinTypeCases));
INSTANTIATE_TEST_SUITE_P(InvalidBuiltinTypeCases,
BuiltinTypeParseTest,
testing::ValuesIn(kInvalidBuiltinTypeCases));
using BuiltinTypePrintTest = testing::TestWithParam<BuiltinTypeCase>;
TEST_P(BuiltinTypePrintTest, Print) {
BuiltinType value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidBuiltinTypeCases,
BuiltinTypePrintTest,
testing::ValuesIn(kValidBuiltinTypeCases));
} // namespace parse_print_tests
namespace parse_print_tests {
struct BuiltinValueCase {
const char* string;
BuiltinValue value;
};
inline std::ostream& operator<<(std::ostream& out, BuiltinValueCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr BuiltinValueCase kValidBuiltinValueCases[] = {
{"clip_distances", BuiltinValue::kClipDistances},
{"frag_depth", BuiltinValue::kFragDepth},
{"front_facing", BuiltinValue::kFrontFacing},
{"global_invocation_id", BuiltinValue::kGlobalInvocationId},
{"instance_index", BuiltinValue::kInstanceIndex},
{"local_invocation_id", BuiltinValue::kLocalInvocationId},
{"local_invocation_index", BuiltinValue::kLocalInvocationIndex},
{"num_workgroups", BuiltinValue::kNumWorkgroups},
{"position", BuiltinValue::kPosition},
{"sample_index", BuiltinValue::kSampleIndex},
{"sample_mask", BuiltinValue::kSampleMask},
{"subgroup_id", BuiltinValue::kSubgroupId},
{"subgroup_invocation_id", BuiltinValue::kSubgroupInvocationId},
{"subgroup_size", BuiltinValue::kSubgroupSize},
{"vertex_index", BuiltinValue::kVertexIndex},
{"workgroup_id", BuiltinValue::kWorkgroupId},
};
static constexpr BuiltinValueCase kInvalidBuiltinValueCases[] = {
{"clEpCCdist33zzppes", BuiltinValue::kUndefined},
{"cliphhdistaddces", BuiltinValue::kUndefined},
{"lip_d77s66ances", BuiltinValue::kUndefined},
{"frag_deptP", BuiltinValue::kUndefined},
{"fraw_depth", BuiltinValue::kUndefined},
{"fragupth", BuiltinValue::kUndefined},
{"fron6_fXXcing", BuiltinValue::kUndefined},
{"ront_fRRig", BuiltinValue::kUndefined},
{"fron_fciVV", BuiltinValue::kUndefined},
{"gloHHGGl_invocation_id", BuiltinValue::kUndefined},
{"Mlobal_invocationFFid", BuiltinValue::kUndefined},
{"global_invoction_id", BuiltinValue::kUndefined},
{"instan3_ggdex", BuiltinValue::kUndefined},
{"PnKKt1n_e_index", BuiltinValue::kUndefined},
{"iEstance_idex", BuiltinValue::kUndefined},
{"loca_invcatiMn_id", BuiltinValue::kUndefined},
{"loGGal_invcSSti77n_iX", BuiltinValue::kUndefined},
{"FFocal_invottation_d", BuiltinValue::kUndefined},
{"local_onUUocsstionZZindex", BuiltinValue::kUndefined},
{"localinvocation_index", BuiltinValue::kUndefined},
{"local_invocationlindex", BuiltinValue::kUndefined},
{"num_workhroups", BuiltinValue::kUndefined},
{"Kum_wokgrouTTs", BuiltinValue::kUndefined},
{"num_werkgrowws", BuiltinValue::kUndefined},
{"jjKsitivv", BuiltinValue::kUndefined},
{"posYYto", BuiltinValue::kUndefined},
{"EEsiIIon", BuiltinValue::kUndefined},
{"sample_indeQQ", BuiltinValue::kUndefined},
{"sampPe_iel", BuiltinValue::kUndefined},
{"saffHle_index", BuiltinValue::kUndefined},
{"sanple_mask", BuiltinValue::kUndefined},
{"sgmpleFas66", BuiltinValue::kUndefined},
{"samp8e_mshsk", BuiltinValue::kUndefined},
{"subgroupFlli", BuiltinValue::kUndefined},
{"jj2bg00up_i", BuiltinValue::kUndefined},
{"suggroup_id", BuiltinValue::kUndefined},
{"subgroupeinvocation_i", BuiltinValue::kUndefined},
{"subgroup_ffnvocatin_id", BuiltinValue::kUndefined},
{"subup_invocation_id", BuiltinValue::kUndefined},
{"subgroup_sze", BuiltinValue::kUndefined},
{"subgrop_sizqq", BuiltinValue::kUndefined},
{"subgAAo_sze", BuiltinValue::kUndefined},
{"vertex_ndex", BuiltinValue::kUndefined},
{"verte_injjex", BuiltinValue::kUndefined},
{"vertZZx_index", BuiltinValue::kUndefined},
{"Oor2grUPIIp_id", BuiltinValue::kUndefined},
{"woZZkgroup_id", BuiltinValue::kUndefined},
{"workgnnoup_id", BuiltinValue::kUndefined},
};
using BuiltinValueParseTest = testing::TestWithParam<BuiltinValueCase>;
TEST_P(BuiltinValueParseTest, Parse) {
const char* string = GetParam().string;
BuiltinValue expect = GetParam().value;
EXPECT_EQ(expect, ParseBuiltinValue(string));
}
INSTANTIATE_TEST_SUITE_P(ValidBuiltinValueCases,
BuiltinValueParseTest,
testing::ValuesIn(kValidBuiltinValueCases));
INSTANTIATE_TEST_SUITE_P(InvalidBuiltinValueCases,
BuiltinValueParseTest,
testing::ValuesIn(kInvalidBuiltinValueCases));
using BuiltinValuePrintTest = testing::TestWithParam<BuiltinValueCase>;
TEST_P(BuiltinValuePrintTest, Print) {
BuiltinValue value = GetParam().value;
const char* expect = GetParam().string;
EXPECT_EQ(expect, ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidBuiltinValueCases,
BuiltinValuePrintTest,
testing::ValuesIn(kValidBuiltinValueCases));
} // namespace parse_print_tests
namespace parse_print_tests {
struct AttributeCase {
const char* string;
Attribute value;
};
inline std::ostream& operator<<(std::ostream& out, AttributeCase c) {
return out << "'" << std::string(c.string) << "'";
}
static constexpr AttributeCase kValidAttributeCases[] = {
{"align", Attribute::kAlign},
{"binding", Attribute::kBinding},
{"blend_src", Attribute::kBlendSrc},
{"builtin", Attribute::kBuiltin},
{"color", Attribute::kColor},
{"compute", Attribute::kCompute},
{"diagnostic", Attribute::kDiagnostic},
{"fragment", Attribute::kFragment},
{"group", Attribute::kGroup},
{"id", Attribute::kId},
{"input_attachment_index", Attribute::kInputAttachmentIndex},
{"interpolate", Attribute::kInterpolate},
{"invariant", Attribute::kInvariant},
{"location", Attribute::kLocation},
{"must_use", Attribute::kMustUse},
{"size", Attribute::kSize},
{"vertex", Attribute::kVertex},
{"workgroup_size", Attribute::kWorkgroupSize},
};
static constexpr AttributeCase kInvalidAttributeCases[] = {
{"HlkkZg22", Attribute::kUndefined},
{"alig", Attribute::kUndefined},
{"igR", Attribute::kUndefined},
{"bindiqq9g", Attribute::kUndefined},
{"bind77ng", Attribute::kUndefined},
{"bini3", Attribute::kUndefined},
{"bluuccd_sr", Attribute::kUndefined},
{"lend_RRrc", Attribute::kUndefined},
{"bllnd_sJJc", Attribute::kUndefined},
{"MMuiI", Attribute::kUndefined},
{"7T6ilxi", Attribute::kUndefined},
{"builtQQJ", Attribute::kUndefined},
{"Aulo", Attribute::kUndefined},
{"coo", Attribute::kUndefined},
{"yoq3", Attribute::kUndefined},
{"coxxpute", Attribute::kUndefined},
{"Nrrpe", Attribute::kUndefined},
{"o99pute", Attribute::kUndefined},
{"diagnostc", Attribute::kUndefined},
{"iaHnlstic", Attribute::kUndefined},
{"i_gnotic", Attribute::kUndefined},
{"fagment", Attribute::kUndefined},
{"fragmjt", Attribute::kUndefined},
{"fragEEmttnt", Attribute::kUndefined},
{"gro", Attribute::kUndefined},
{"rourr", Attribute::kUndefined},
{"xoup", Attribute::kUndefined},
{"Q", Attribute::kUndefined},
{"ppss", Attribute::kUndefined},
{"Wuu", Attribute::kUndefined},
{"itputTT00ttachmet_index", Attribute::kUndefined},
{"inut_atvvchment_inex", Attribute::kUndefined},
{"Qnput_attachment_index", Attribute::kUndefined},
{"in3RrpoCae", Attribute::kUndefined},
{"inerCat", Attribute::kUndefined},
{"ntrpPPrppate", Attribute::kUndefined},
{"xx8DDuvaiant", Attribute::kUndefined},
{"lldqqvarYYant", Attribute::kUndefined},
{"iFF__arian", Attribute::kUndefined},
{"rocaGNNion", Attribute::kUndefined},
{"Mocltion", Attribute::kUndefined},
{"caton", Attribute::kUndefined},
{"qxst_ule", Attribute::kUndefined},
{"must_ue", Attribute::kUndefined},
{"ma44t_ue", Attribute::kUndefined},
{"WWiGe", Attribute::kUndefined},
{"sjjz", Attribute::kUndefined},
{"sjjze", Attribute::kUndefined},
{"vrtjx", Attribute::kUndefined},
{"vetex", Attribute::kUndefined},
{"vert99x", Attribute::kUndefined},
{"worVVgyoup_size", Attribute::kUndefined},
{"workZZxoup_sze", Attribute::kUndefined},
{"w33kgvvoup_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