blob: 4afb2acdabed83fe57b855fd7936c70534b9e452 [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},
{"texel_buffer", BuiltinType::kTexelBuffer},
{"texture_1d", BuiltinType::kTexture1D},
{"texture_2d", BuiltinType::kTexture2D},
{"texture_2d_array", BuiltinType::kTexture2DArray},
{"texture_3d", BuiltinType::kTexture3D},
{"texture_cube", BuiltinType::kTextureCube},
{"texture_cube_array", BuiltinType::kTextureCubeArray},
{"texture_depth_2d", BuiltinType::kTextureDepth2D},
{"texture_depth_2d_array", BuiltinType::kTextureDepth2DArray},
{"texture_depth_cube", BuiltinType::kTextureDepthCube},
{"texture_depth_cube_array", BuiltinType::kTextureDepthCubeArray},
{"texture_depth_multisampled_2d", BuiltinType::kTextureDepthMultisampled2D},
{"texture_external", BuiltinType::kTextureExternal},
{"texture_multisampled_2d", BuiltinType::kTextureMultisampled2D},
{"texture_storage_1d", BuiltinType::kTextureStorage1D},
{"texture_storage_2d", BuiltinType::kTextureStorage2D},
{"texture_storage_2d_array", BuiltinType::kTextureStorage2DArray},
{"texture_storage_3d", BuiltinType::kTextureStorage3D},
{"u32", BuiltinType::kU32},
{"u8", BuiltinType::kU8},
{"vec2", BuiltinType::kVec2},
{"vec2f", BuiltinType::kVec2F},
{"vec2h", BuiltinType::kVec2H},
{"vec2i", BuiltinType::kVec2I},
{"vec2u", BuiltinType::kVec2U},
{"vec3", BuiltinType::kVec3},
{"vec3f", BuiltinType::kVec3F},
{"vec3h", BuiltinType::kVec3H},
{"vec3i", BuiltinType::kVec3I},
{"vec3u", BuiltinType::kVec3U},
{"vec4", BuiltinType::kVec4},
{"vec4f", BuiltinType::kVec4F},
{"vec4h", BuiltinType::kVec4H},
{"vec4i", BuiltinType::kVec4I},
{"vec4u", BuiltinType::kVec4U},
};
static constexpr BuiltinTypeCase kInvalidBuiltinTypeCases[] = {
{"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},
{"OOexN_buffr", BuiltinType::kUndefined},
{"txtl_bfGr", BuiltinType::kUndefined},
{"texel_5uffer", BuiltinType::kUndefined},
{"99jffture_1d", BuiltinType::kUndefined},
{"texRurevY1XX", BuiltinType::kUndefined},
{"exurc_1d", BuiltinType::kUndefined},
{"texXX5e88d", BuiltinType::kUndefined},
{"textur_2", BuiltinType::kUndefined},
{"textupp_ccd", BuiltinType::kUndefined},
{"tvxture_2d_array", BuiltinType::kUndefined},
{"tSSxtue_2EE_Jrray", BuiltinType::kUndefined},
{"texture_2daray", BuiltinType::kUndefined},
{"aex_red", BuiltinType::kUndefined},
{"textwwre_d", BuiltinType::kUndefined},
{"texddur99_3d", BuiltinType::kUndefined},
{"extPPre99ube", BuiltinType::kUndefined},
{"teture_KKube", BuiltinType::kUndefined},
{"teture_ooubDD", BuiltinType::kUndefined},
{"eBtiie_cubearray", BuiltinType::kUndefined},
{"texure_cube_aqay", BuiltinType::kUndefined},
{"texturecbe_arr0LLy", BuiltinType::kUndefined},
{"texture_dep66hvv2d", BuiltinType::kUndefined},
{"nrrture_depth_2d", BuiltinType::kUndefined},
{"teeetureepthxx2d", BuiltinType::kUndefined},
{"texture_dONNtCC_2d_array", BuiltinType::kUndefined},
{"texture_depth_2d_rray", BuiltinType::kUndefined},
{"texture_d4pth_2a_array", BuiltinType::kUndefined},
{"NNexNNure_deth_cube", BuiltinType::kUndefined},
{"texure_depth_cube", BuiltinType::kUndefined},
{"texture_dpthcuue", BuiltinType::kUndefined},
{"tSxtuAe_deYYth_cubEE_arry", BuiltinType::kUndefined},
{"texture_depth_cube_0rray", BuiltinType::kUndefined},
{"texaaure_depth_cube_array", BuiltinType::kUndefined},
{"teture_depth_mmultismpleqq_2d", BuiltinType::kUndefined},
{"textre_depth_multisampled_2d", BuiltinType::kUndefined},
{"texture_dEpth_UUltisampld_2d", BuiltinType::kUndefined},
{"txure_exKKeDDnal", BuiltinType::kUndefined},
{"0exture_exte__nat", BuiltinType::kUndefined},
{"tpturl_etArnal", BuiltinType::kUndefined},
{"textuMe_multisampled_2", BuiltinType::kUndefined},
{"texture_multisampledBB2d", BuiltinType::kUndefined},
{"textnne_m99lbbisamled_2d", BuiltinType::kUndefined},
{"texture_sEEoAAage11", BuiltinType::kUndefined},
{"teTture66stora5e_1d", BuiltinType::kUndefined},
{"textuHe_storage_1d", BuiltinType::kUndefined},
{"texture_sxoraHHe2d", BuiltinType::kUndefined},
{"zexture_storyy0e_2n", BuiltinType::kUndefined},
{"texture_storage_d", BuiltinType::kUndefined},
{"texture_storage_2dHkray", BuiltinType::kUndefined},
{"texture_storage_2darcay", BuiltinType::kUndefined},
{"ooexrrure_sorge_2d_array", BuiltinType::kUndefined},
{"textre_stoJJge_3d", BuiltinType::kUndefined},
{"tCCxtu0e_storage_d", BuiltinType::kUndefined},
{"texturAAsxor99gF_3d", BuiltinType::kUndefined},
{"uc2", BuiltinType::kUndefined},
{"S32", BuiltinType::kUndefined},
{"oBs", BuiltinType::kUndefined},
{"8", BuiltinType::kUndefined},
{"me", BuiltinType::kUndefined},
{"gQPP", BuiltinType::kUndefined},
{"9", BuiltinType::kUndefined},
{"xxec2", BuiltinType::kUndefined},
{"NKsc2", BuiltinType::kUndefined},
{"vcrp9", BuiltinType::kUndefined},
{"7yZZVVf", BuiltinType::kUndefined},
{"vec1pf", BuiltinType::kUndefined},
{"v00c2h", BuiltinType::kUndefined},
{"ecJBPss", BuiltinType::kUndefined},
{"fcffJJh", BuiltinType::kUndefined},
{"XXI2i", BuiltinType::kUndefined},
{"", BuiltinType::kUndefined},
{"ve2i", BuiltinType::kUndefined},
{"uKKcu", BuiltinType::kUndefined},
{"m4d2u", BuiltinType::kUndefined},
{"veo2u", BuiltinType::kUndefined},
{"vhjHNN", BuiltinType::kUndefined},
{"vEw3Uc3", BuiltinType::kUndefined},
{"vuc", BuiltinType::kUndefined},
{"rddccf", BuiltinType::kUndefined},
{"2Pttcf", BuiltinType::kUndefined},
{"vwwcsf", BuiltinType::kUndefined},
{"11ennch", BuiltinType::kUndefined},
{"ve3h", BuiltinType::kUndefined},
{"vech", BuiltinType::kUndefined},
{"ecaSSIi", BuiltinType::kUndefined},
{"vED3i", BuiltinType::kUndefined},
{"veIccR", BuiltinType::kUndefined},
{"ec9", BuiltinType::kUndefined},
{"aec3u", BuiltinType::kUndefined},
{"LSc3u", BuiltinType::kUndefined},
{"mmc", BuiltinType::kUndefined},
{"4eV", BuiltinType::kUndefined},
{"ec_", BuiltinType::kUndefined},
{"vQ4", BuiltinType::kUndefined},
{"veERdd", BuiltinType::kUndefined},
{"vec9", BuiltinType::kUndefined},
{"e04", BuiltinType::kUndefined},
{"vzh", BuiltinType::kUndefined},
{"veccch", BuiltinType::kUndefined},
{"v_Qci", BuiltinType::kUndefined},
{"vect", BuiltinType::kUndefined},
{"zz3ecECpp", BuiltinType::kUndefined},
{"veddhhu", BuiltinType::kUndefined},
{"e7766u", BuiltinType::kUndefined},
{"vec4P", 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[] = {
{"cliw_distances", BuiltinValue::kUndefined},
{"clp_disunces", BuiltinValue::kUndefined},
{"6lip_distanXXes", BuiltinValue::kUndefined},
{"rag_RRpt", BuiltinValue::kUndefined},
{"fVgde1th", BuiltinValue::kUndefined},
{"fragGGdepHHh", BuiltinValue::kUndefined},
{"MFFon7_facing", BuiltinValue::kUndefined},
{"fron_facing", BuiltinValue::kUndefined},
{"3roTgg_fcin", BuiltinValue::kUndefined},
{"globQl_i_vK1cation_Pd", BuiltinValue::kUndefined},
{"Elobal_invocaton_id", BuiltinValue::kUndefined},
{"lobal_invocatin_iM", BuiltinValue::kUndefined},
{"77nsSSane_XndeGG", BuiltinValue::kUndefined},
{"inFFtaKcettndex", BuiltinValue::kUndefined},
{"onstssUnce_indZZx", BuiltinValue::kUndefined},
{"local_invocaion_id", BuiltinValue::kUndefined},
{"local_invocltion_id", BuiltinValue::kUndefined},
{"lhcal_invocation_id", BuiltinValue::kUndefined},
{"locTTKknvocation_index", BuiltinValue::kUndefined},
{"local_ievowwationindex", BuiltinValue::kUndefined},
{"local_invocavioKjjindex", BuiltinValue::kUndefined},
{"num_worgrupYY", BuiltinValue::kUndefined},
{"nm_EEorkgroupI", BuiltinValue::kUndefined},
{"num_worQQgroups", BuiltinValue::kUndefined},
{"poPilo", BuiltinValue::kUndefined},
{"postioffH", BuiltinValue::kUndefined},
{"pnsition", BuiltinValue::kUndefined},
{"Fampg_i66dex", BuiltinValue::kUndefined},
{"hample_iss8ex", BuiltinValue::kUndefined},
{"samleFFilldex", BuiltinValue::kUndefined},
{"jj2mp00_mas", BuiltinValue::kUndefined},
{"sagple_mask", BuiltinValue::kUndefined},
{"sample_mas", BuiltinValue::kUndefined},
{"subgrop_ffd", BuiltinValue::kUndefined},
{"subgu_id", BuiltinValue::kUndefined},
{"subgroup_i", BuiltinValue::kUndefined},
{"subgroqqp_nvocation_id", BuiltinValue::kUndefined},
{"subgroup_nocatioAAid", BuiltinValue::kUndefined},
{"subgrup_invocation_vd", BuiltinValue::kUndefined},
{"subgjjoup_ize", BuiltinValue::kUndefined},
{"subgrouZZ_size", BuiltinValue::kUndefined},
{"subgroupUsizII2", BuiltinValue::kUndefined},
{"veZZtex_index", BuiltinValue::kUndefined},
{"vertenn_index", BuiltinValue::kUndefined},
{"vertHx_iZkkd22x", BuiltinValue::kUndefined},
{"workgrop_id", BuiltinValue::kUndefined},
{"workRoupid", BuiltinValue::kUndefined},
{"workg99ouqq_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[] = {
{"alig77", Attribute::kUndefined},
{"a3n", Attribute::kUndefined},
{"aligcu", Attribute::kUndefined},
{"b1nRRng", Attribute::kUndefined},
{"bindllJg", Attribute::kUndefined},
{"MMinI", Attribute::kUndefined},
{"ble7d6Txc", Attribute::kUndefined},
{"blenJ_QQrc", Attribute::kUndefined},
{"buuend_A", Attribute::kUndefined},
{"builn", Attribute::kUndefined},
{"bl33qn", Attribute::kUndefined},
{"buxxltin", Attribute::kUndefined},
{"lrr", Attribute::kUndefined},
{"c99lr", Attribute::kUndefined},
{"colr", Attribute::kUndefined},
{"olHute", Attribute::kUndefined},
{"_oute", Attribute::kUndefined},
{"compte", Attribute::kUndefined},
{"djgnostic", Attribute::kUndefined},
{"mmEEagttostic", Attribute::kUndefined},
{"iagnosti", Attribute::kUndefined},
{"frrrment", Attribute::kUndefined},
{"fagmext", Attribute::kUndefined},
{"frzzent", Attribute::kUndefined},
{"groue", Attribute::kUndefined},
{"uouZp", Attribute::kUndefined},
{"00uo7TT", Attribute::kUndefined},
{"F", Attribute::kUndefined},
{"UJ", Attribute::kUndefined},
{"i", Attribute::kUndefined},
{"input_attachment_OOndex", Attribute::kUndefined},
{"inputattaMMment_index", Attribute::kUndefined},
{"input_Cttachment_index", Attribute::kUndefined},
{"iPPterpolQQte", Attribute::kUndefined},
{"inDDxxuuola88e", Attribute::kUndefined},
{"inmeqqpddlYYlle", Attribute::kUndefined},
{"iFF__arian", Attribute::kUndefined},
{"rrnvNNGrian", Attribute::kUndefined},
{"Mnvarialt", Attribute::kUndefined},
{"caton", Attribute::kUndefined},
{"qxcatiln", Attribute::kUndefined},
{"locatin", Attribute::kUndefined},
{"ma44t_ue", Attribute::kUndefined},
{"WWuGt_use", Attribute::kUndefined},
{"mujjt_us", Attribute::kUndefined},
{"sjjze", Attribute::kUndefined},
{"sje", Attribute::kUndefined},
{"sie", Attribute::kUndefined},
{"vert99x", Attribute::kUndefined},
{"verVVex", Attribute::kUndefined},
{"ZZxrtx", Attribute::kUndefined},
{"w33kgvvoup_size", Attribute::kUndefined},
{"workgsoup9size", Attribute::kUndefined},
{"worgrFup_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