2016-01-07 18:44:22 +00:00
|
|
|
// Copyright (c) 2015-2016 The Khronos Group Inc.
|
2015-10-26 19:43:12 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
2015-10-26 19:43:12 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2015-10-26 19:43:12 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2015-10-26 19:43:12 +00:00
|
|
|
|
2016-09-22 15:05:30 +00:00
|
|
|
#include "unit_spirv.h"
|
2015-10-26 19:43:12 +00:00
|
|
|
|
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
2015-12-22 20:15:46 +00:00
|
|
|
#include "source/opcode.h"
|
2015-10-26 19:43:12 +00:00
|
|
|
|
2018-07-11 13:24:49 +00:00
|
|
|
namespace spvtools {
|
2015-10-26 19:43:12 +00:00
|
|
|
namespace {
|
|
|
|
|
2018-07-11 13:24:49 +00:00
|
|
|
using ::spvtest::EnumCase;
|
|
|
|
using ::testing::Eq;
|
2015-10-26 19:43:12 +00:00
|
|
|
using GeneratorMagicNumberTest =
|
|
|
|
::testing::TestWithParam<EnumCase<spv_generator_t>>;
|
|
|
|
|
|
|
|
TEST_P(GeneratorMagicNumberTest, Single) {
|
|
|
|
EXPECT_THAT(std::string(spvGeneratorStr(GetParam().value())),
|
|
|
|
GetParam().name());
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
Registered, GeneratorMagicNumberTest,
|
|
|
|
::testing::ValuesIn(std::vector<EnumCase<spv_generator_t>>{
|
|
|
|
{SPV_GENERATOR_KHRONOS, "Khronos"},
|
|
|
|
{SPV_GENERATOR_LUNARG, "LunarG"},
|
|
|
|
{SPV_GENERATOR_VALVE, "Valve"},
|
2016-12-09 19:01:43 +00:00
|
|
|
{SPV_GENERATOR_CODEPLAY, "Codeplay"},
|
2015-10-26 19:43:12 +00:00
|
|
|
{SPV_GENERATOR_NVIDIA, "NVIDIA"},
|
|
|
|
{SPV_GENERATOR_ARM, "ARM"},
|
2015-11-12 23:33:47 +00:00
|
|
|
{SPV_GENERATOR_KHRONOS_LLVM_TRANSLATOR,
|
|
|
|
"Khronos LLVM/SPIR-V Translator"},
|
|
|
|
{SPV_GENERATOR_KHRONOS_ASSEMBLER, "Khronos SPIR-V Tools Assembler"},
|
2015-11-13 18:03:28 +00:00
|
|
|
{SPV_GENERATOR_KHRONOS_GLSLANG, "Khronos Glslang Reference Front End"},
|
2017-11-27 15:16:41 +00:00
|
|
|
}), );
|
2015-10-26 19:43:12 +00:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
Unregistered, GeneratorMagicNumberTest,
|
|
|
|
::testing::ValuesIn(std::vector<EnumCase<spv_generator_t>>{
|
2016-12-09 19:01:43 +00:00
|
|
|
// We read registered entries from the SPIR-V XML Registry file
|
|
|
|
// which can change over time.
|
|
|
|
{spv_generator_t(1000), "Unknown"},
|
2015-10-26 19:43:12 +00:00
|
|
|
{spv_generator_t(9999), "Unknown"},
|
2017-11-27 15:16:41 +00:00
|
|
|
}), );
|
2018-07-11 13:24:49 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace spvtools
|