// Copyright 2026 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/wgsl/enums_test.cc.tmpl
//
// To regenerate run: './tools/run gen'
//
//                       Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////

// clang-format off

#include <string>

#include "gtest/gtest.h"

#include "src/tint/lang/wgsl/enums.h"
#include "src/tint/utils/text/string.h"

namespace tint::wgsl {
namespace {

namespace core_diagnostic_rule_tests {
namespace parse_print_tests {

struct CoreDiagnosticRuleCase {
    const char* string;
    CoreDiagnosticRule value;
};

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

static constexpr CoreDiagnosticRuleCase kValidCoreDiagnosticRuleCases[] = {
    {"derivative_uniformity", CoreDiagnosticRule::kDerivativeUniformity},
    {"subgroup_uniformity", CoreDiagnosticRule::kSubgroupUniformity},
};

static constexpr CoreDiagnosticRuleCase kInvalidCoreDiagnosticRuleCases[] = {
    {"deriative_unccformity", CoreDiagnosticRule::kUndefined},
    {"dlivative_3iformiy", CoreDiagnosticRule::kUndefined},
    {"derivative_uniforVity", CoreDiagnosticRule::kUndefined},
    {"s1bgroup_uniformity", CoreDiagnosticRule::kUndefined},
    {"subgrouqq_unifJrmty", CoreDiagnosticRule::kUndefined},
    {"sub77roup_ulliformity", CoreDiagnosticRule::kUndefined},
};

using CoreDiagnosticRuleParseTest = testing::TestWithParam<CoreDiagnosticRuleCase>;

TEST_P(CoreDiagnosticRuleParseTest, Parse) {
    const char* string = GetParam().string;
    CoreDiagnosticRule expect = GetParam().value;
    EXPECT_EQ(expect, ParseCoreDiagnosticRule(string));
}

INSTANTIATE_TEST_SUITE_P(ValidCoreDiagnosticRuleCases, CoreDiagnosticRuleParseTest, testing::ValuesIn(kValidCoreDiagnosticRuleCases));
INSTANTIATE_TEST_SUITE_P(InvalidCoreDiagnosticRuleCases, CoreDiagnosticRuleParseTest, testing::ValuesIn(kInvalidCoreDiagnosticRuleCases));

using CoreDiagnosticRulePrintTest = testing::TestWithParam<CoreDiagnosticRuleCase>;

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

INSTANTIATE_TEST_SUITE_P(ValidCoreDiagnosticRuleCases, CoreDiagnosticRulePrintTest, testing::ValuesIn(kValidCoreDiagnosticRuleCases));

}  // namespace parse_print_tests
}  // namespace core_diagnostic_rule_tests

namespace chromium_diagnostic_rule_tests {
namespace parse_print_tests {

struct ChromiumDiagnosticRuleCase {
    const char* string;
    ChromiumDiagnosticRule value;
};

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

static constexpr ChromiumDiagnosticRuleCase kValidChromiumDiagnosticRuleCases[] = {
    {"subgroup_matrix_uniformity", ChromiumDiagnosticRule::kSubgroupMatrixUniformity},
    {"unreachable_code", ChromiumDiagnosticRule::kUnreachableCode},
};

static constexpr ChromiumDiagnosticRuleCase kInvalidChromiumDiagnosticRuleCases[] = {
    {"subgroppHp_matriqq_uiformity", ChromiumDiagnosticRule::kUndefined},
    {"subroup_matrcx_niformit", ChromiumDiagnosticRule::kUndefined},
    {"subroupGmatrbx_uniformity", ChromiumDiagnosticRule::kUndefined},
    {"vnriiachable_code", ChromiumDiagnosticRule::kUndefined},
    {"unreac8ablWW_code", ChromiumDiagnosticRule::kUndefined},
    {"unreMchablxxcode", ChromiumDiagnosticRule::kUndefined},
};

using ChromiumDiagnosticRuleParseTest = testing::TestWithParam<ChromiumDiagnosticRuleCase>;

TEST_P(ChromiumDiagnosticRuleParseTest, Parse) {
    const char* string = GetParam().string;
    ChromiumDiagnosticRule expect = GetParam().value;
    EXPECT_EQ(expect, ParseChromiumDiagnosticRule(string));
}

INSTANTIATE_TEST_SUITE_P(ValidChromiumDiagnosticRuleCases, ChromiumDiagnosticRuleParseTest, testing::ValuesIn(kValidChromiumDiagnosticRuleCases));
INSTANTIATE_TEST_SUITE_P(InvalidChromiumDiagnosticRuleCases, ChromiumDiagnosticRuleParseTest, testing::ValuesIn(kInvalidChromiumDiagnosticRuleCases));

using ChromiumDiagnosticRulePrintTest = testing::TestWithParam<ChromiumDiagnosticRuleCase>;

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

INSTANTIATE_TEST_SUITE_P(ValidChromiumDiagnosticRuleCases, ChromiumDiagnosticRulePrintTest, testing::ValuesIn(kValidChromiumDiagnosticRuleCases));

}  // namespace parse_print_tests
}  // namespace chromium_diagnostic_rule_tests

namespace diagnostic_severity_tests {
namespace parse_print_tests {

struct DiagnosticSeverityCase {
    const char* string;
    DiagnosticSeverity value;
};

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

static constexpr DiagnosticSeverityCase kValidDiagnosticSeverityCases[] = {
    {"error", DiagnosticSeverity::kError},
    {"info", DiagnosticSeverity::kInfo},
    {"off", DiagnosticSeverity::kOff},
    {"warning", DiagnosticSeverity::kWarning},
};

static constexpr DiagnosticSeverityCase kInvalidDiagnosticSeverityCases[] = {
    {"eggor", DiagnosticSeverity::kUndefined},
    {"VoX", DiagnosticSeverity::kUndefined},
    {"erro3", DiagnosticSeverity::kUndefined},
    {"infE", DiagnosticSeverity::kUndefined},
    {"TTPfo", DiagnosticSeverity::kUndefined},
    {"xxnfo", DiagnosticSeverity::kUndefined},
    {"44ff", DiagnosticSeverity::kUndefined},
    {"oSVVf", DiagnosticSeverity::kUndefined},
    {"RR2", DiagnosticSeverity::kUndefined},
    {"wFni9g", DiagnosticSeverity::kUndefined},
    {"waring", DiagnosticSeverity::kUndefined},
    {"VOORRHng", DiagnosticSeverity::kUndefined},
};

using DiagnosticSeverityParseTest = testing::TestWithParam<DiagnosticSeverityCase>;

TEST_P(DiagnosticSeverityParseTest, Parse) {
    const char* string = GetParam().string;
    DiagnosticSeverity expect = GetParam().value;
    EXPECT_EQ(expect, ParseDiagnosticSeverity(string));
}

INSTANTIATE_TEST_SUITE_P(ValidDiagnosticSeverityCases, DiagnosticSeverityParseTest, testing::ValuesIn(kValidDiagnosticSeverityCases));
INSTANTIATE_TEST_SUITE_P(InvalidDiagnosticSeverityCases, DiagnosticSeverityParseTest, testing::ValuesIn(kInvalidDiagnosticSeverityCases));

using DiagnosticSeverityPrintTest = testing::TestWithParam<DiagnosticSeverityCase>;

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

INSTANTIATE_TEST_SUITE_P(ValidDiagnosticSeverityCases, DiagnosticSeverityPrintTest, testing::ValuesIn(kValidDiagnosticSeverityCases));

}  // namespace parse_print_tests
}  // namespace diagnostic_severity_tests

namespace parse_print_tests {

struct ExtensionCase {
    const char* string;
    Extension value;
};

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

static constexpr ExtensionCase kValidExtensionCases[] = {
    {"atomic_vec2u_min_max", Extension::kAtomicVec2UMinMax},
    {"chromium_disable_uniformity_analysis", Extension::kChromiumDisableUniformityAnalysis},
    {"chromium_experimental_barycentric_coord", Extension::kChromiumExperimentalBarycentricCoord},
    {"chromium_experimental_framebuffer_fetch", Extension::kChromiumExperimentalFramebufferFetch},
    {"chromium_experimental_pixel_local", Extension::kChromiumExperimentalPixelLocal},
    {"chromium_experimental_resource_table", Extension::kChromiumExperimentalResourceTable},
    {"chromium_experimental_subgroup_matrix", Extension::kChromiumExperimentalSubgroupMatrix},
    {"chromium_internal_input_attachments", Extension::kChromiumInternalInputAttachments},
    {"clip_distances", Extension::kClipDistances},
    {"dual_source_blending", Extension::kDualSourceBlending},
    {"f16", Extension::kF16},
    {"primitive_index", Extension::kPrimitiveIndex},
    {"subgroup_size_control", Extension::kSubgroupSizeControl},
    {"subgroups", Extension::kSubgroups},
};

static constexpr ExtensionCase kInvalidExtensionCases[] = {
    {"atomic_vyc2u_mi_max", Extension::kUndefined},
    {"atomrrlln_vec2u_min_mG77", Extension::kUndefined},
    {"atom00c_vec2u_mi4_max", Extension::kUndefined},
    {"chromoou_disable_uniority_analysis", Extension::kUndefined},
    {"chromium_disableuifzzrmity_analysis", Extension::kUndefined},
    {"chromim_dippable_uniiform11ty_aalysis", Extension::kUndefined},
    {"chXXomium_experimental_barycentric_coord", Extension::kUndefined},
    {"chr99mi55m_experiIIennnal_barycentric_coord", Extension::kUndefined},
    {"chromiumSSerrperimenaaal_barHHcentric_cooYd", Extension::kUndefined},
    {"chromum_xperimentalframebuffHrkkfetch", Extension::kUndefined},
    {"chrojium_xRReimental_frgmebuffer_fetch", Extension::kUndefined},
    {"hromium_experimental_ramebbffer_fetch", Extension::kUndefined},
    {"chromium_experimentjl_pixel_local", Extension::kUndefined},
    {"chroium_experimental_pixel_local", Extension::kUndefined},
    {"cromium_qxperimental_pixl_local", Extension::kUndefined},
    {"chromium_experimetal_resource_NNable", Extension::kUndefined},
    {"chrvvmium_experimentl_resource_tble", Extension::kUndefined},
    {"chromium_experiental_resource_taQQle", Extension::kUndefined},
    {"hromium_exprimertal_subgroup_ffatrix", Extension::kUndefined},
    {"chromium_ejperimental_subgroup_matrix", Extension::kUndefined},
    {"chromium_expewim8n2al_subgroupNNmatrix", Extension::kUndefined},
    {"chromium_internalinput_attachments", Extension::kUndefined},
    {"crrromium_internal_input_attachments", Extension::kUndefined},
    {"Ghromium_internal_input_attachments", Extension::kUndefined},
    {"clip_distanceFF", Extension::kUndefined},
    {"cEipdtances", Extension::kUndefined},
    {"cli_rristances", Extension::kUndefined},
    {"dual_suce_blending", Extension::kUndefined},
    {"dul_DoXrcJJ_blending", Extension::kUndefined},
    {"dul_source_lening", Extension::kUndefined},
    {"k", Extension::kUndefined},
    {"16", Extension::kUndefined},
    {"J1", Extension::kUndefined},
    {"primitive_incex", Extension::kUndefined},
    {"pOimitive_index", Extension::kUndefined},
    {"__rimiKKitte_indevv", Extension::kUndefined},
    {"xxu8grup_size_c5ntrol", Extension::kUndefined},
    {"subrqqp_siFe_con__rol", Extension::kUndefined},
    {"subroup_size_conqqrol", Extension::kUndefined},
    {"subgr6u33O", Extension::kUndefined},
    {"s96grQttupoo", Extension::kUndefined},
    {"sugro66ps", Extension::kUndefined},
};

using ExtensionParseTest = testing::TestWithParam<ExtensionCase>;

TEST_P(ExtensionParseTest, Parse) {
    const char* string = GetParam().string;
    Extension expect = GetParam().value;
    EXPECT_EQ(expect, ParseExtension(string));
}

INSTANTIATE_TEST_SUITE_P(ValidExtensionCases, ExtensionParseTest, testing::ValuesIn(kValidExtensionCases));
INSTANTIATE_TEST_SUITE_P(InvalidExtensionCases, ExtensionParseTest, testing::ValuesIn(kInvalidExtensionCases));

using ExtensionPrintTest = testing::TestWithParam<ExtensionCase>;

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

INSTANTIATE_TEST_SUITE_P(ValidExtensionCases, ExtensionPrintTest, testing::ValuesIn(kValidExtensionCases));

}  // namespace parse_print_tests

namespace parse_print_tests {

struct LanguageFeatureCase {
    const char* string;
    LanguageFeature value;
};

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

static constexpr LanguageFeatureCase kValidLanguageFeatureCases[] = {
    {"buffer_view", LanguageFeature::kBufferView},
    {"chromium_print", LanguageFeature::kChromiumPrint},
    {"chromium_testing_experimental", LanguageFeature::kChromiumTestingExperimental},
    {"chromium_testing_shipped", LanguageFeature::kChromiumTestingShipped},
    {"chromium_testing_shipped_with_killswitch", LanguageFeature::kChromiumTestingShippedWithKillswitch},
    {"chromium_testing_unimplemented", LanguageFeature::kChromiumTestingUnimplemented},
    {"chromium_testing_unsafe_experimental", LanguageFeature::kChromiumTestingUnsafeExperimental},
    {"fragment_depth", LanguageFeature::kFragmentDepth},
    {"immediate_address_space", LanguageFeature::kImmediateAddressSpace},
    {"linear_indexing", LanguageFeature::kLinearIndexing},
    {"packed_4x8_integer_dot_product", LanguageFeature::kPacked4X8IntegerDotProduct},
    {"pointer_composite_access", LanguageFeature::kPointerCompositeAccess},
    {"readonly_and_readwrite_storage_textures", LanguageFeature::kReadonlyAndReadwriteStorageTextures},
    {"sized_binding_array", LanguageFeature::kSizedBindingArray},
    {"subgroup_id", LanguageFeature::kSubgroupId},
    {"subgroup_uniformity", LanguageFeature::kSubgroupUniformity},
    {"swizzle_assignment", LanguageFeature::kSwizzleAssignment},
    {"texel_buffers", LanguageFeature::kTexelBuffers},
    {"texture_and_sampler_let", LanguageFeature::kTextureAndSamplerLet},
    {"texture_formats_tier1", LanguageFeature::kTextureFormatsTier1},
    {"uniform_buffer_standard_layout", LanguageFeature::kUniformBufferStandardLayout},
    {"unrestricted_pointer_parameters", LanguageFeature::kUnrestrictedPointerParameters},
};

static constexpr LanguageFeatureCase kInvalidLanguageFeatureCases[] = {
    {"bufxr66vieOz", LanguageFeature::kUndefined},
    {"yyuffer_view", LanguageFeature::kUndefined},
    {"uffeZZHiew", LanguageFeature::kUndefined},
    {"cWW4romiuqprint", LanguageFeature::kUndefined},
    {"chromium_rOOnt", LanguageFeature::kUndefined},
    {"oohomYum_phnt", LanguageFeature::kUndefined},
    {"chromium_testin_experienal", LanguageFeature::kUndefined},
    {"chromium_tesFig_experimental", LanguageFeature::kUndefined},
    {"chromium_testing_expewimentl", LanguageFeature::kUndefined},
    {"chromiumtestinGKhippeff", LanguageFeature::kUndefined},
    {"chrqKmium_testing_shipped", LanguageFeature::kUndefined},
    {"cFromium_test3ng_shmmpped", LanguageFeature::kUndefined},
    {"chromium_testing_shipped_wit_killswitch", LanguageFeature::kUndefined},
    {"chromum_testing_shipqed_with_killswitch", LanguageFeature::kUndefined},
    {"chromium_testing_shipped_with_killbbbtch", LanguageFeature::kUndefined},
    {"chromiim_testing_unimplemnted", LanguageFeature::kUndefined},
    {"chromiumOOtestqngunimplemented", LanguageFeature::kUndefined},
    {"chromium_testivvg_unimplementTTd", LanguageFeature::kUndefined},
    {"chroFFium_testing_unsafe_experimental", LanguageFeature::kUndefined},
    {"chromiuftesting_uPsaQe_00xperimental", LanguageFeature::kUndefined},
    {"chPomium_testing_unsafe_experimental", LanguageFeature::kUndefined},
    {"fragment_77epsh", LanguageFeature::kUndefined},
    {"RRrbbgment_Cepth", LanguageFeature::kUndefined},
    {"fXXagment_depth", LanguageFeature::kUndefined},
    {"imedOOatq_addrOOssCCspace", LanguageFeature::kUndefined},
    {"imediLts_address_space", LanguageFeature::kUndefined},
    {"immediate_addresX_space", LanguageFeature::kUndefined},
    {"liear_indexing", LanguageFeature::kUndefined},
    {"lqqnaridexOng", LanguageFeature::kUndefined},
    {"linear_indexin22", LanguageFeature::kUndefined},
    {"packe0_zzy8_inXXeger_dot_produc", LanguageFeature::kUndefined},
    {"packed_4x8_inteier_doVPproduct", LanguageFeature::kUndefined},
    {"pacCed_x8_integenn_dot_product", LanguageFeature::kUndefined},
    {"pintHH_qqomposite_aAAcess", LanguageFeature::kUndefined},
    {"ointer_composite_access", LanguageFeature::kUndefined},
    {"poiterKKcomposie_acfess", LanguageFeature::kUndefined},
    {"readonly_ggnd_readwrite_sPorage_xturel", LanguageFeature::kUndefined},
    {"readonly_and_readwrite_storage_texture", LanguageFeature::kUndefined},
    {"readcnly_and_reaNwrite_stTTrag4_textures", LanguageFeature::kUndefined},
    {"slzepp7_bining_array", LanguageFeature::kUndefined},
    {"sgzed_bndigNNzarray", LanguageFeature::kUndefined},
    {"sized_indibbg_XXrauu", LanguageFeature::kUndefined},
    {"subgrou_id", LanguageFeature::kUndefined},
    {"KbQrou88id", LanguageFeature::kUndefined},
    {"sub9ropqid", LanguageFeature::kUndefined},
    {"subgroup_uniform11ty", LanguageFeature::kUndefined},
    {"subgr22ip_unifFrmity", LanguageFeature::kUndefined},
    {"su77roup_uniformity", LanguageFeature::kUndefined},
    {"Nwizzle_assignme2t", LanguageFeature::kUndefined},
    {"VVwizzle_assignment", LanguageFeature::kUndefined},
    {"swizzleFWWssignm11nt", LanguageFeature::kUndefined},
    {"tewwel_buffrs", LanguageFeature::kUndefined},
    {"texel_buDfers", LanguageFeature::kUndefined},
    {"texl_bufferK", LanguageFeature::kUndefined},
    {"textuPP1e_andhsampfer_ret", LanguageFeature::kUndefined},
    {"texture_and_samper_let", LanguageFeature::kUndefined},
    {"tYYxture_and_sampler_let", LanguageFeature::kUndefined},
    {"ttxturV_formats_tirHkk", LanguageFeature::kUndefined},
    {"texture_formats_tirrr1", LanguageFeature::kUndefined},
    {"textre_WWormats_ssier1", LanguageFeature::kUndefined},
    {"unform_buffer_standarY_layout", LanguageFeature::kUndefined},
    {"uniffrm_buffer_standLrd_lyoqt", LanguageFeature::kUndefined},
    {"vvniffm_buffer_standarduulayo22t", LanguageFeature::kUndefined},
    {"unrestricted_pointr_paraeters", LanguageFeature::kUndefined},
    {"unrstricted_poiYYter_parametes", LanguageFeature::kUndefined},
    {"unrestrYYEted_y7ointer_parameters", LanguageFeature::kUndefined},
};

using LanguageFeatureParseTest = testing::TestWithParam<LanguageFeatureCase>;

TEST_P(LanguageFeatureParseTest, Parse) {
    const char* string = GetParam().string;
    LanguageFeature expect = GetParam().value;
    EXPECT_EQ(expect, ParseLanguageFeature(string));
}

INSTANTIATE_TEST_SUITE_P(ValidLanguageFeatureCases, LanguageFeatureParseTest, testing::ValuesIn(kValidLanguageFeatureCases));
INSTANTIATE_TEST_SUITE_P(InvalidLanguageFeatureCases, LanguageFeatureParseTest, testing::ValuesIn(kInvalidLanguageFeatureCases));

using LanguageFeaturePrintTest = testing::TestWithParam<LanguageFeatureCase>;

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

INSTANTIATE_TEST_SUITE_P(ValidLanguageFeatureCases, LanguageFeaturePrintTest, testing::ValuesIn(kValidLanguageFeatureCases));

}  // namespace parse_print_tests

}  // namespace
}  // namespace tint::wgsl

// clang-format on
