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