From 1b5fd4962ee3c9fedfe1bb0c7b2e9c2cba637218 Mon Sep 17 00:00:00 2001 From: David Neto Date: Mon, 21 Sep 2015 11:36:44 -0400 Subject: [PATCH] Put the test fixture into spvtest namespace. All test utility code should go into the spvtest namespace. --- test/AssemblyFormat.cpp | 2 +- test/BinaryDestroy.cpp | 2 +- test/Comment.cpp | 2 +- test/ImmediateInt.cpp | 2 +- test/TestFixture.h | 4 ++-- test/TextToBinary.Annotation.cpp | 8 ++++---- test/TextToBinary.Constant.cpp | 4 ++-- test/TextToBinary.ControlFlow.cpp | 5 ++--- test/TextToBinary.Debug.cpp | 4 ++-- test/TextToBinary.Function.cpp | 4 ++-- test/TextToBinary.Group.cpp | 2 +- test/TextToBinary.Image.cpp | 2 +- test/TextToBinary.Literal.cpp | 2 +- test/TextToBinary.Memory.cpp | 6 +++--- test/TextToBinary.Miscellaneous.cpp | 4 ++-- test/TextToBinary.ModeSetting.cpp | 8 ++++---- test/TextToBinary.TypeDeclaration.cpp | 6 +++--- test/TextToBinary.cpp | 4 ++-- 18 files changed, 35 insertions(+), 36 deletions(-) diff --git a/test/AssemblyFormat.cpp b/test/AssemblyFormat.cpp index d9b646dc..8cd51d78 100755 --- a/test/AssemblyFormat.cpp +++ b/test/AssemblyFormat.cpp @@ -28,7 +28,7 @@ namespace { -using test_fixture::TextToBinaryTest; +using spvtest::TextToBinaryTest; TEST_F(TextToBinaryTest, EncodeAAFTextAsAAF) { SetText("%2 = OpConstant %1 1000"); diff --git a/test/BinaryDestroy.cpp b/test/BinaryDestroy.cpp index 2dc7de51..98d7ba8c 100644 --- a/test/BinaryDestroy.cpp +++ b/test/BinaryDestroy.cpp @@ -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) { diff --git a/test/Comment.cpp b/test/Comment.cpp index ff7d8231..f3a29b6e 100644 --- a/test/Comment.cpp +++ b/test/Comment.cpp @@ -29,7 +29,7 @@ namespace { -using test_fixture::TextToBinaryTest; +using spvtest::TextToBinaryTest; TEST_F(TextToBinaryTest, Whitespace) { SetText(R"( diff --git a/test/ImmediateInt.cpp b/test/ImmediateInt.cpp index ec7fec07..35589e2a 100644 --- a/test/ImmediateInt.cpp +++ b/test/ImmediateInt.cpp @@ -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; diff --git a/test/TestFixture.h b/test/TestFixture.h index 2eb48f06..8d27ab4f 100644 --- a/test/TestFixture.h +++ b/test/TestFixture.h @@ -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_ diff --git a/test/TextToBinary.Annotation.cpp b/test/TextToBinary.Annotation.cpp index 0ab5c1b9..8924d157 100755 --- a/test/TextToBinary.Annotation.cpp +++ b/test/TextToBinary.Annotation.cpp @@ -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>; + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; 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>; 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>; TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) { diff --git a/test/TextToBinary.Constant.cpp b/test/TextToBinary.Constant.cpp index 70b7f91f..bc0a7ff1 100755 --- a/test/TextToBinary.Constant.cpp +++ b/test/TextToBinary.Constant.cpp @@ -39,7 +39,7 @@ using ::testing::Eq; // Test Sampler Addressing Mode enum values -using SamplerAddressingModeTest = test_fixture::TextToBinaryTestBase< +using SamplerAddressingModeTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>>; 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>>; TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) { diff --git a/test/TextToBinary.ControlFlow.cpp b/test/TextToBinary.ControlFlow.cpp index 06d817e0..946cb0e7 100755 --- a/test/TextToBinary.ControlFlow.cpp +++ b/test/TextToBinary.ControlFlow.cpp @@ -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>>; 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>>; TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) { diff --git a/test/TextToBinary.Debug.cpp b/test/TextToBinary.Debug.cpp index 35f72626..ba1a9c52 100755 --- a/test/TextToBinary.Debug.cpp +++ b/test/TextToBinary.Debug.cpp @@ -67,7 +67,7 @@ const LanguageCase kLanguageCases[] = { // clang-format on using OpSourceTest = - test_fixture::TextToBinaryTestBase<::testing::TestWithParam>; + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; 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>; + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; TEST_P(OpSourceExtensionTest, AnyExtension) { // TODO(dneto): utf-8, quoting, escaping diff --git a/test/TextToBinary.Function.cpp b/test/TextToBinary.Function.cpp index 39e8a1cf..382001a0 100755 --- a/test/TextToBinary.Function.cpp +++ b/test/TextToBinary.Function.cpp @@ -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>>; TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) { diff --git a/test/TextToBinary.Group.cpp b/test/TextToBinary.Group.cpp index dc0d214d..68d326c4 100755 --- a/test/TextToBinary.Group.cpp +++ b/test/TextToBinary.Group.cpp @@ -39,7 +39,7 @@ using ::testing::Eq; // Test GroupOperation enum -using GroupOperationTest = test_fixture::TextToBinaryTestBase< +using GroupOperationTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>>; TEST_P(GroupOperationTest, AnyGroupOperation) { diff --git a/test/TextToBinary.Image.cpp b/test/TextToBinary.Image.cpp index 18546622..b6ecdfc0 100644 --- a/test/TextToBinary.Image.cpp +++ b/test/TextToBinary.Image.cpp @@ -46,7 +46,7 @@ struct ImageOperandsCase { // Test all kinds of image operands. -using ImageOperandsTest = test_fixture::TextToBinaryTestBase< +using ImageOperandsTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>; TEST_P(ImageOperandsTest, Sample) { diff --git a/test/TextToBinary.Literal.cpp b/test/TextToBinary.Literal.cpp index bff4c722..c95f879b 100644 --- a/test/TextToBinary.Literal.cpp +++ b/test/TextToBinary.Literal.cpp @@ -30,7 +30,7 @@ namespace { -using test_fixture::TextToBinaryTest; +using spvtest::TextToBinaryTest; TEST_F(TextToBinaryTest, LiteralStringInPlaceOfLiteralNumber) { EXPECT_EQ( diff --git a/test/TextToBinary.Memory.cpp b/test/TextToBinary.Memory.cpp index dbb47252..41ed3a32 100755 --- a/test/TextToBinary.Memory.cpp +++ b/test/TextToBinary.Memory.cpp @@ -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 @@ -51,7 +51,7 @@ struct EnumCaseWithOperands { // Test assembly of Memory Access masks -using MemoryAccessTest = test_fixture::TextToBinaryTestBase< +using MemoryAccessTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>>; 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>>; TEST_P(StorageClassTest, AnyStorageClass) { diff --git a/test/TextToBinary.Miscellaneous.cpp b/test/TextToBinary.Miscellaneous.cpp index b08813e5..5125ebe0 100644 --- a/test/TextToBinary.Miscellaneous.cpp +++ b/test/TextToBinary.Miscellaneous.cpp @@ -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, {}))); diff --git a/test/TextToBinary.ModeSetting.cpp b/test/TextToBinary.ModeSetting.cpp index 2bad4c53..53799cff 100755 --- a/test/TextToBinary.ModeSetting.cpp +++ b/test/TextToBinary.ModeSetting.cpp @@ -54,7 +54,7 @@ struct MemoryModelCase { std::string memory_name; }; -using OpMemoryModelTest = test_fixture::TextToBinaryTestBase< +using OpMemoryModelTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>; 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>; TEST_P(OpEntryPointTest, AnyEntryPointCase) { @@ -140,7 +140,7 @@ struct ExecutionModeCase { std::vector operands; }; -using OpExecutionModeTest = test_fixture::TextToBinaryTestBase< +using OpExecutionModeTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>; 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>>; TEST_P(OpCapabilityTest, AnyCapability) { diff --git a/test/TextToBinary.TypeDeclaration.cpp b/test/TextToBinary.TypeDeclaration.cpp index 96482186..909058b3 100755 --- a/test/TextToBinary.TypeDeclaration.cpp +++ b/test/TextToBinary.TypeDeclaration.cpp @@ -39,7 +39,7 @@ using ::testing::Eq; // Test Dim enums via OpTypeImage -using DimTest = test_fixture::TextToBinaryTestBase< +using DimTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>>; 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>>; 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>>; TEST_P(OpTypePipeTest, AnyAccessQualifier) { diff --git a/test/TextToBinary.cpp b/test/TextToBinary.cpp index 61ab12ea..c1446a69 100755 --- a/test/TextToBinary.cpp +++ b/test/TextToBinary.cpp @@ -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>>; TEST_P(TextToBinaryFloatValueTest, NormalValues) {