mirror of
https://gitee.com/openharmony/third_party_spirv-tools
synced 2024-11-23 07:20:28 +00:00
Fix round trip tests that weren't instantiated (#3417)
Need to actually instantiate them with TEST_P in the same source file. Remove the instantiation of RoundTripTest from unit.cpp because it's viewed as having no instantiations.
This commit is contained in:
parent
e498967098
commit
458140aed9
@ -485,8 +485,15 @@ const int64_t kMaxUnsigned48Bit = (int64_t(1) << 48) - 1;
|
||||
const int64_t kMaxSigned48Bit = (int64_t(1) << 47) - 1;
|
||||
const int64_t kMinSigned48Bit = -kMaxSigned48Bit - 1;
|
||||
|
||||
using ConstantRoundTripTest = RoundTripTest;
|
||||
|
||||
TEST_P(ConstantRoundTripTest, DisassemblyEqualsAssemblyInput) {
|
||||
const std::string assembly = GetParam();
|
||||
EXPECT_THAT(EncodeAndDecodeSuccessfully(assembly), Eq(assembly)) << assembly;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
OpConstantRoundTrip, RoundTripTest,
|
||||
OpConstantRoundTrip, ConstantRoundTripTest,
|
||||
::testing::ValuesIn(std::vector<std::string>{
|
||||
// 16 bit
|
||||
"%1 = OpTypeInt 16 0\n%2 = OpConstant %1 0\n",
|
||||
@ -529,7 +536,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
}));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
OpConstantHalfRoundTrip, RoundTripTest,
|
||||
OpConstantHalfRoundTrip, ConstantRoundTripTest,
|
||||
::testing::ValuesIn(std::vector<std::string>{
|
||||
"%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x0p+0\n",
|
||||
"%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x0p+0\n",
|
||||
@ -566,7 +573,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
// clang-format off
|
||||
// (Clang-format really wants to break up these strings across lines.
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
OpConstantRoundTripNonFinite, RoundTripTest,
|
||||
OpConstantRoundTripNonFinite, ConstantRoundTripTest,
|
||||
::testing::ValuesIn(std::vector<std::string>{
|
||||
"%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1p+128\n", // -inf
|
||||
"%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1p+128\n", // inf
|
||||
@ -596,7 +603,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
// clang-format on
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
OpSpecConstantRoundTrip, RoundTripTest,
|
||||
OpSpecConstantRoundTrip, ConstantRoundTripTest,
|
||||
::testing::ValuesIn(std::vector<std::string>{
|
||||
// 16 bit
|
||||
"%1 = OpTypeInt 16 0\n%2 = OpSpecConstant %1 0\n",
|
||||
|
@ -293,8 +293,15 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
MakeSwitchTestCase(64, 1, "0x700000123", {0x123, 7}, "12", {12, 0}),
|
||||
})));
|
||||
|
||||
using ControlFlowRoundTripTest = RoundTripTest;
|
||||
|
||||
TEST_P(ControlFlowRoundTripTest, DisassemblyEqualsAssemblyInput) {
|
||||
const std::string assembly = GetParam();
|
||||
EXPECT_THAT(EncodeAndDecodeSuccessfully(assembly), Eq(assembly)) << assembly;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
OpSwitchRoundTripUnsignedIntegers, RoundTripTest,
|
||||
OpSwitchRoundTripUnsignedIntegers, ControlFlowRoundTripTest,
|
||||
ValuesIn(std::vector<std::string>({
|
||||
// Unsigned 16-bit.
|
||||
"%1 = OpTypeInt 16 0\n%2 = OpConstant %1 65535\nOpSwitch %2 %3\n",
|
||||
@ -310,7 +317,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
})));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
OpSwitchRoundTripSignedIntegers, RoundTripTest,
|
||||
OpSwitchRoundTripSignedIntegers, ControlFlowRoundTripTest,
|
||||
ValuesIn(std::vector<std::string>{
|
||||
// Signed 16-bit, with two non-default cases
|
||||
"%1 = OpTypeInt 16 1\n%2 = OpConstant %1 32767\n"
|
||||
|
@ -47,10 +47,5 @@ TEST(WordVectorPrintTo, PreservesFlagsAndFill) {
|
||||
EXPECT_THAT(s.str(), Eq("xx10 0x0000000a 0x00000010 xx11"));
|
||||
}
|
||||
|
||||
TEST_P(RoundTripTest, Sample) {
|
||||
EXPECT_THAT(EncodeAndDecodeSuccessfully(GetParam()), Eq(GetParam()))
|
||||
<< GetParam();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace spvtools
|
||||
|
Loading…
Reference in New Issue
Block a user