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

#include "src/tint/lang/wgsl/extension.h"

#include <gtest/gtest.h>

#include <string>

#include "src/tint/utils/text/string.h"

namespace tint::wgsl {
namespace {

namespace parse_print_tests {

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

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

static constexpr Case kValidCases[] = {
    {"chromium_disable_uniformity_analysis", Extension::kChromiumDisableUniformityAnalysis},
    {"chromium_experimental_framebuffer_fetch", Extension::kChromiumExperimentalFramebufferFetch},
    {"chromium_experimental_pixel_local", Extension::kChromiumExperimentalPixelLocal},
    {"chromium_experimental_push_constant", Extension::kChromiumExperimentalPushConstant},
    {"chromium_experimental_subgroup_matrix", Extension::kChromiumExperimentalSubgroupMatrix},
    {"chromium_experimental_subgroups", Extension::kChromiumExperimentalSubgroups},
    {"chromium_internal_graphite", Extension::kChromiumInternalGraphite},
    {"chromium_internal_input_attachments", Extension::kChromiumInternalInputAttachments},
    {"chromium_internal_relaxed_uniform_layout", Extension::kChromiumInternalRelaxedUniformLayout},
    {"clip_distances", Extension::kClipDistances},
    {"dual_source_blending", Extension::kDualSourceBlending},
    {"f16", Extension::kF16},
    {"subgroups", Extension::kSubgroups},
    {"subgroups_f16", Extension::kSubgroupsF16},
};

static constexpr Case kInvalidCases[] = {
    {"chromium_disableuniformiccy_analysis", Extension::kUndefined},
    {"chromil3_disable_unifority_analss", Extension::kUndefined},
    {"chromium_disable_Vniformity_analysis", Extension::kUndefined},
    {"chromium_experimental_framebuf1er_fetch", Extension::kUndefined},
    {"chromium_experiqqntal_framebuffer_fetch", Extension::kUndefined},
    {"chromium_experimental_framebuffll77_fetch", Extension::kUndefined},
    {"chroqqppum_expermental_pixel_HHocal", Extension::kUndefined},
    {"chromium_experimenta_piel_occl", Extension::kUndefined},
    {"chromium_exeGimental_pixel_local", Extension::kUndefined},
    {"chvomium_experimental_push_constiint", Extension::kUndefined},
    {"chromiu8WWexperimental_push_constant", Extension::kUndefined},
    {"chromium_experiMental_push_costanxx", Extension::kUndefined},
    {"cXromium_experimeggtal_subgrup_matrix", Extension::kUndefined},
    {"chrXmiuu_expeimVtal_subgroup_matrix", Extension::kUndefined},
    {"chromium_e3perimental_subgroup_matrix", Extension::kUndefined},
    {"cEromium_experimental_subgroups", Extension::kUndefined},
    {"TThromium_experiPPental_sugroups", Extension::kUndefined},
    {"chddomium_experimental_subgroxxs", Extension::kUndefined},
    {"chromi44m_internal_graphite", Extension::kUndefined},
    {"chromSSuVV_internal_graphite", Extension::kUndefined},
    {"cRromium_nternR22_graphite", Extension::kUndefined},
    {"chromium_int9rnaF_inpu_attachments", Extension::kUndefined},
    {"chrmium_internal_input_attachments", Extension::kUndefined},
    {"cOOromium_internVlHinput_ttachRRents", Extension::kUndefined},
    {"chromium_internl_relaxyd_uniform_layout", Extension::kUndefined},
    {"chromnnum_internrr77_Gelaxell_uniform_layout", Extension::kUndefined},
    {"chromium_intern4l_relaxe00_uniform_layout", Extension::kUndefined},
    {"cli_iootanes", Extension::kUndefined},
    {"czip_dstances", Extension::kUndefined},
    {"lipp_distan11es", Extension::kUndefined},
    {"XXual_source_blending", Extension::kUndefined},
    {"dual_sou5IIcennblend99ng", Extension::kUndefined},
    {"aSSual_soYrce_blerrdinHH", Extension::kUndefined},
    {"U", Extension::kUndefined},
    {"jV3", Extension::kUndefined},
    {"", Extension::kUndefined},
    {"uGGSrops", Extension::kUndefined},
    {"subgous", Extension::kUndefined},
    {"bgrups", Extension::kUndefined},
    {"subgrokp_jj6", Extension::kUndefined},
    {"ubgroupsffr6", Extension::kUndefined},
    {"subgroujs_f16", Extension::kUndefined},
};

using ExtensionParseTest = testing::TestWithParam<Case>;

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

INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionParseTest, testing::ValuesIn(kValidCases));
INSTANTIATE_TEST_SUITE_P(InvalidCases, ExtensionParseTest, testing::ValuesIn(kInvalidCases));

using ExtensionPrintTest = testing::TestWithParam<Case>;

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

INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionPrintTest, testing::ValuesIn(kValidCases));

}  // namespace parse_print_tests

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