mirror of
https://github.com/RPCSX/SPIRV-Tools.git
synced 2025-01-27 06:11:47 +00:00
Put the test fixture into spvtest namespace.
All test utility code should go into the spvtest namespace.
This commit is contained in:
parent
815cb95247
commit
1b5fd4962e
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using test_fixture::TextToBinaryTest;
|
using spvtest::TextToBinaryTest;
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, EncodeAAFTextAsAAF) {
|
TEST_F(TextToBinaryTest, EncodeAAFTextAsAAF) {
|
||||||
SetText("%2 = OpConstant %1 1000");
|
SetText("%2 = OpConstant %1 1000");
|
||||||
|
@ -36,7 +36,7 @@ TEST(BinaryDestroy, Null) {
|
|||||||
spvBinaryDestroy(nullptr);
|
spvBinaryDestroy(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
using BinaryDestroySomething = test_fixture::TextToBinaryTest;
|
using BinaryDestroySomething = spvtest::TextToBinaryTest;
|
||||||
|
|
||||||
// Checks safety of destroying a validly constructed binary.
|
// Checks safety of destroying a validly constructed binary.
|
||||||
TEST_F(BinaryDestroySomething, Default) {
|
TEST_F(BinaryDestroySomething, Default) {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using test_fixture::TextToBinaryTest;
|
using spvtest::TextToBinaryTest;
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, Whitespace) {
|
TEST_F(TextToBinaryTest, Whitespace) {
|
||||||
SetText(R"(
|
SetText(R"(
|
||||||
|
@ -34,10 +34,10 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using spvtest::TextToBinaryTest;
|
||||||
using ::testing::ElementsAre;
|
using ::testing::ElementsAre;
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
using ::testing::StrEq;
|
using ::testing::StrEq;
|
||||||
using test_fixture::TextToBinaryTest;
|
|
||||||
|
|
||||||
const auto kCAF = SPV_ASSEMBLY_SYNTAX_FORMAT_CANONICAL;
|
const auto kCAF = SPV_ASSEMBLY_SYNTAX_FORMAT_CANONICAL;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "UnitSPIRV.h"
|
#include "UnitSPIRV.h"
|
||||||
|
|
||||||
namespace test_fixture {
|
namespace spvtest {
|
||||||
|
|
||||||
// Common setup for TextToBinary tests. SetText() should be called to populate
|
// Common setup for TextToBinary tests. SetText() should be called to populate
|
||||||
// the actual test text.
|
// the actual test text.
|
||||||
@ -164,6 +164,6 @@ class TextToBinaryTestBase : public T {
|
|||||||
|
|
||||||
using TextToBinaryTest = TextToBinaryTestBase<::testing::Test>;
|
using TextToBinaryTest = TextToBinaryTestBase<::testing::Test>;
|
||||||
|
|
||||||
} // namespace test_fixture
|
} // namespace spvtest
|
||||||
|
|
||||||
#endif // _TEXT_FIXTURE_H_
|
#endif // _TEXT_FIXTURE_H_
|
||||||
|
@ -38,8 +38,8 @@ namespace {
|
|||||||
|
|
||||||
using spvtest::MakeInstruction;
|
using spvtest::MakeInstruction;
|
||||||
using spvtest::MakeVector;
|
using spvtest::MakeVector;
|
||||||
|
using spvtest::TextToBinaryTest;
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using test_fixture::TextToBinaryTest;
|
|
||||||
|
|
||||||
// Test OpDecorate
|
// Test OpDecorate
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ struct DecorateSimpleCase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
using OpDecorateSimpleTest =
|
using OpDecorateSimpleTest =
|
||||||
test_fixture::TextToBinaryTestBase<::testing::TestWithParam<DecorateSimpleCase>>;
|
spvtest::TextToBinaryTestBase<::testing::TestWithParam<DecorateSimpleCase>>;
|
||||||
|
|
||||||
TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) {
|
TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) {
|
||||||
// This string should assemble, but should not validate.
|
// This string should assemble, but should not validate.
|
||||||
@ -124,7 +124,7 @@ struct DecorateEnumCase {
|
|||||||
std::string enum_name;
|
std::string enum_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
using OpDecorateEnumTest = test_fixture::TextToBinaryTestBase<
|
using OpDecorateEnumTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<DecorateEnumCase>>;
|
::testing::TestWithParam<DecorateEnumCase>>;
|
||||||
|
|
||||||
TEST_P(OpDecorateEnumTest, AnyEnumDecoration) {
|
TEST_P(OpDecorateEnumTest, AnyEnumDecoration) {
|
||||||
@ -259,7 +259,7 @@ struct DecorateLinkageCase {
|
|||||||
std::string external_name;
|
std::string external_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
using OpDecorateLinkageTest = test_fixture::TextToBinaryTestBase<
|
using OpDecorateLinkageTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<DecorateLinkageCase>>;
|
::testing::TestWithParam<DecorateLinkageCase>>;
|
||||||
|
|
||||||
TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) {
|
TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) {
|
||||||
|
@ -39,7 +39,7 @@ using ::testing::Eq;
|
|||||||
|
|
||||||
// Test Sampler Addressing Mode enum values
|
// Test Sampler Addressing Mode enum values
|
||||||
|
|
||||||
using SamplerAddressingModeTest = test_fixture::TextToBinaryTestBase<
|
using SamplerAddressingModeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::SamplerAddressingMode>>>;
|
::testing::TestWithParam<EnumCase<spv::SamplerAddressingMode>>>;
|
||||||
|
|
||||||
TEST_P(SamplerAddressingModeTest, AnySamplerAddressingMode) {
|
TEST_P(SamplerAddressingModeTest, AnySamplerAddressingMode) {
|
||||||
@ -66,7 +66,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
|
|
||||||
// Test Sampler Filter Mode enum values
|
// Test Sampler Filter Mode enum values
|
||||||
|
|
||||||
using SamplerFilterModeTest = test_fixture::TextToBinaryTestBase<
|
using SamplerFilterModeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::SamplerFilterMode>>>;
|
::testing::TestWithParam<EnumCase<spv::SamplerFilterMode>>>;
|
||||||
|
|
||||||
TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) {
|
TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) {
|
||||||
|
@ -36,11 +36,10 @@ namespace {
|
|||||||
|
|
||||||
using spvtest::MakeInstruction;
|
using spvtest::MakeInstruction;
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using test_fixture::TextToBinaryTest;
|
|
||||||
|
|
||||||
// Test OpSelectionMerge
|
// Test OpSelectionMerge
|
||||||
|
|
||||||
using OpSelectionMergeTest = test_fixture::TextToBinaryTestBase<
|
using OpSelectionMergeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::SelectionControlMask>>>;
|
::testing::TestWithParam<EnumCase<spv::SelectionControlMask>>>;
|
||||||
|
|
||||||
TEST_P(OpSelectionMergeTest, AnySingleSelectionControlMask) {
|
TEST_P(OpSelectionMergeTest, AnySingleSelectionControlMask) {
|
||||||
@ -71,7 +70,7 @@ TEST_F(OpSelectionMergeTest, CombinedSelectionControlMask) {
|
|||||||
|
|
||||||
// Test OpLoopMerge
|
// Test OpLoopMerge
|
||||||
|
|
||||||
using OpLoopMergeTest = test_fixture::TextToBinaryTestBase<
|
using OpLoopMergeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::LoopControlMask>>>;
|
::testing::TestWithParam<EnumCase<spv::LoopControlMask>>>;
|
||||||
|
|
||||||
TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) {
|
TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) {
|
||||||
|
@ -67,7 +67,7 @@ const LanguageCase kLanguageCases[] = {
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
using OpSourceTest =
|
using OpSourceTest =
|
||||||
test_fixture::TextToBinaryTestBase<::testing::TestWithParam<LanguageCase>>;
|
spvtest::TextToBinaryTestBase<::testing::TestWithParam<LanguageCase>>;
|
||||||
|
|
||||||
TEST_P(OpSourceTest, AnyLanguage) {
|
TEST_P(OpSourceTest, AnyLanguage) {
|
||||||
std::string input = std::string("OpSource ") + GetParam().language_name +
|
std::string input = std::string("OpSource ") + GetParam().language_name +
|
||||||
@ -83,7 +83,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceTest,
|
|||||||
// Test OpSourceExtension
|
// Test OpSourceExtension
|
||||||
|
|
||||||
using OpSourceExtensionTest =
|
using OpSourceExtensionTest =
|
||||||
test_fixture::TextToBinaryTestBase<::testing::TestWithParam<const char*>>;
|
spvtest::TextToBinaryTestBase<::testing::TestWithParam<const char*>>;
|
||||||
|
|
||||||
TEST_P(OpSourceExtensionTest, AnyExtension) {
|
TEST_P(OpSourceExtensionTest, AnyExtension) {
|
||||||
// TODO(dneto): utf-8, quoting, escaping
|
// TODO(dneto): utf-8, quoting, escaping
|
||||||
|
@ -35,12 +35,12 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using spvtest::MakeInstruction;
|
using spvtest::MakeInstruction;
|
||||||
|
using spvtest::TextToBinaryTest;;
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using test_fixture::TextToBinaryTest;;
|
|
||||||
|
|
||||||
// Test OpFunction
|
// Test OpFunction
|
||||||
|
|
||||||
using OpFunctionControlTest = test_fixture::TextToBinaryTestBase<
|
using OpFunctionControlTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::FunctionControlMask>>>;
|
::testing::TestWithParam<EnumCase<spv::FunctionControlMask>>>;
|
||||||
|
|
||||||
TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) {
|
TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) {
|
||||||
|
@ -39,7 +39,7 @@ using ::testing::Eq;
|
|||||||
|
|
||||||
// Test GroupOperation enum
|
// Test GroupOperation enum
|
||||||
|
|
||||||
using GroupOperationTest = test_fixture::TextToBinaryTestBase<
|
using GroupOperationTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::GroupOperation>>>;
|
::testing::TestWithParam<EnumCase<spv::GroupOperation>>>;
|
||||||
|
|
||||||
TEST_P(GroupOperationTest, AnyGroupOperation) {
|
TEST_P(GroupOperationTest, AnyGroupOperation) {
|
||||||
|
@ -46,7 +46,7 @@ struct ImageOperandsCase {
|
|||||||
|
|
||||||
// Test all kinds of image operands.
|
// Test all kinds of image operands.
|
||||||
|
|
||||||
using ImageOperandsTest = test_fixture::TextToBinaryTestBase<
|
using ImageOperandsTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<ImageOperandsCase>>;
|
::testing::TestWithParam<ImageOperandsCase>>;
|
||||||
|
|
||||||
TEST_P(ImageOperandsTest, Sample) {
|
TEST_P(ImageOperandsTest, Sample) {
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using test_fixture::TextToBinaryTest;
|
using spvtest::TextToBinaryTest;
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, LiteralStringInPlaceOfLiteralNumber) {
|
TEST_F(TextToBinaryTest, LiteralStringInPlaceOfLiteralNumber) {
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using spvtest::MakeInstruction;
|
using spvtest::MakeInstruction;
|
||||||
|
using spvtest::TextToBinaryTest;
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using test_fixture::TextToBinaryTest;
|
|
||||||
|
|
||||||
// An example case for an enumerated value.
|
// An example case for an enumerated value.
|
||||||
template <typename E>
|
template <typename E>
|
||||||
@ -51,7 +51,7 @@ struct EnumCaseWithOperands {
|
|||||||
|
|
||||||
// Test assembly of Memory Access masks
|
// Test assembly of Memory Access masks
|
||||||
|
|
||||||
using MemoryAccessTest = test_fixture::TextToBinaryTestBase<
|
using MemoryAccessTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCaseWithOperands<spv::MemoryAccessMask>>>;
|
::testing::TestWithParam<EnumCaseWithOperands<spv::MemoryAccessMask>>>;
|
||||||
|
|
||||||
TEST_P(MemoryAccessTest, AnySingleMemoryAccessMask) {
|
TEST_P(MemoryAccessTest, AnySingleMemoryAccessMask) {
|
||||||
@ -86,7 +86,7 @@ TEST_F(TextToBinaryTest, CombinedMemoryAccessMask) {
|
|||||||
|
|
||||||
// Test Storage Class enum values
|
// Test Storage Class enum values
|
||||||
|
|
||||||
using StorageClassTest = test_fixture::TextToBinaryTestBase<
|
using StorageClassTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCaseWithOperands<spv::StorageClass>>>;
|
::testing::TestWithParam<EnumCaseWithOperands<spv::StorageClass>>>;
|
||||||
|
|
||||||
TEST_P(StorageClassTest, AnyStorageClass) {
|
TEST_P(StorageClassTest, AnyStorageClass) {
|
||||||
|
@ -34,11 +34,11 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using SpirvVector = test_fixture::TextToBinaryTest::SpirvVector;
|
using SpirvVector = spvtest::TextToBinaryTest::SpirvVector;
|
||||||
using spv::Op;
|
using spv::Op;
|
||||||
using spvtest::MakeInstruction;
|
using spvtest::MakeInstruction;
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using TextToBinaryMisc = test_fixture::TextToBinaryTest;
|
using TextToBinaryMisc = spvtest::TextToBinaryTest;
|
||||||
|
|
||||||
TEST_F(TextToBinaryMisc, OpNop) {
|
TEST_F(TextToBinaryMisc, OpNop) {
|
||||||
EXPECT_THAT(CompiledInstructions("OpNop"), Eq(MakeInstruction(OpNop, {})));
|
EXPECT_THAT(CompiledInstructions("OpNop"), Eq(MakeInstruction(OpNop, {})));
|
||||||
|
@ -54,7 +54,7 @@ struct MemoryModelCase {
|
|||||||
std::string memory_name;
|
std::string memory_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
using OpMemoryModelTest = test_fixture::TextToBinaryTestBase<
|
using OpMemoryModelTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<MemoryModelCase>>;
|
::testing::TestWithParam<MemoryModelCase>>;
|
||||||
|
|
||||||
TEST_P(OpMemoryModelTest, AnyMemoryModelCase) {
|
TEST_P(OpMemoryModelTest, AnyMemoryModelCase) {
|
||||||
@ -97,7 +97,7 @@ struct EntryPointCase {
|
|||||||
std::string entry_point_name;
|
std::string entry_point_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
using OpEntryPointTest = test_fixture::TextToBinaryTestBase<
|
using OpEntryPointTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EntryPointCase>>;
|
::testing::TestWithParam<EntryPointCase>>;
|
||||||
|
|
||||||
TEST_P(OpEntryPointTest, AnyEntryPointCase) {
|
TEST_P(OpEntryPointTest, AnyEntryPointCase) {
|
||||||
@ -140,7 +140,7 @@ struct ExecutionModeCase {
|
|||||||
std::vector<uint32_t> operands;
|
std::vector<uint32_t> operands;
|
||||||
};
|
};
|
||||||
|
|
||||||
using OpExecutionModeTest = test_fixture::TextToBinaryTestBase<
|
using OpExecutionModeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<ExecutionModeCase>>;
|
::testing::TestWithParam<ExecutionModeCase>>;
|
||||||
|
|
||||||
TEST_P(OpExecutionModeTest, AnyExecutionMode) {
|
TEST_P(OpExecutionModeTest, AnyExecutionMode) {
|
||||||
@ -199,7 +199,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryExecutionMode, OpExecutionModeTest,
|
|||||||
|
|
||||||
// Test OpCapability
|
// Test OpCapability
|
||||||
|
|
||||||
using OpCapabilityTest = test_fixture::TextToBinaryTestBase<
|
using OpCapabilityTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::Capability>>>;
|
::testing::TestWithParam<EnumCase<spv::Capability>>>;
|
||||||
|
|
||||||
TEST_P(OpCapabilityTest, AnyCapability) {
|
TEST_P(OpCapabilityTest, AnyCapability) {
|
||||||
|
@ -39,7 +39,7 @@ using ::testing::Eq;
|
|||||||
|
|
||||||
// Test Dim enums via OpTypeImage
|
// Test Dim enums via OpTypeImage
|
||||||
|
|
||||||
using DimTest = test_fixture::TextToBinaryTestBase<
|
using DimTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::Dim>>>;
|
::testing::TestWithParam<EnumCase<spv::Dim>>>;
|
||||||
|
|
||||||
TEST_P(DimTest, AnyDim) {
|
TEST_P(DimTest, AnyDim) {
|
||||||
@ -69,7 +69,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
|
|
||||||
// Test ImageFormat enums via OpTypeImage
|
// Test ImageFormat enums via OpTypeImage
|
||||||
|
|
||||||
using ImageFormatTest = test_fixture::TextToBinaryTestBase<
|
using ImageFormatTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::ImageFormat>>>;
|
::testing::TestWithParam<EnumCase<spv::ImageFormat>>>;
|
||||||
|
|
||||||
TEST_P(ImageFormatTest, AnyImageFormat) {
|
TEST_P(ImageFormatTest, AnyImageFormat) {
|
||||||
@ -132,7 +132,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
|
|
||||||
// Test AccessQualifier enums via OpTypePipe.
|
// Test AccessQualifier enums via OpTypePipe.
|
||||||
|
|
||||||
using OpTypePipeTest = test_fixture::TextToBinaryTestBase<
|
using OpTypePipeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::AccessQualifier>>>;
|
::testing::TestWithParam<EnumCase<spv::AccessQualifier>>>;
|
||||||
|
|
||||||
TEST_P(OpTypePipeTest, AnyAccessQualifier) {
|
TEST_P(OpTypePipeTest, AnyAccessQualifier) {
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using test_fixture::TextToBinaryTest;
|
using spvtest::TextToBinaryTest;
|
||||||
|
|
||||||
TEST(GetWord, Simple) {
|
TEST(GetWord, Simple) {
|
||||||
EXPECT_EQ("", spvGetWord(""));
|
EXPECT_EQ("", spvGetWord(""));
|
||||||
@ -462,7 +462,7 @@ TEST_F(TextToBinaryTest, BadSwitchTruncatedCase) {
|
|||||||
diagnostic->error);
|
diagnostic->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
using TextToBinaryFloatValueTest = test_fixture::TextToBinaryTestBase<
|
using TextToBinaryFloatValueTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<std::pair<std::string, uint32_t>>>;
|
::testing::TestWithParam<std::pair<std::string, uint32_t>>>;
|
||||||
|
|
||||||
TEST_P(TextToBinaryFloatValueTest, NormalValues) {
|
TEST_P(TextToBinaryFloatValueTest, NormalValues) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user