reader/spirv: Fix ExpectEq() tests

Don't end the EXPECT_THAT() with `<< ToString(p->builder(), fe.ast_body());`
This string is already emitted in the error, and calling ast_body() a second time triggers an assert as the builder is already finalized.

Change-Id: Ied6aca73937e86aa6ce2d8cff8a09f67b5082349
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47767
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-04-15 15:28:13 +00:00 committed by Commit Bot service account
parent cc46e393e4
commit 31804e09ed
9 changed files with 107 additions and 181 deletions

View File

@ -155,8 +155,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) {
ScalarConstructor[not set]{30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
@ -184,8 +183,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
@ -213,8 +211,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
@ -244,8 +241,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
@ -275,8 +271,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
@ -308,8 +303,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
@ -341,8 +335,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
@ -376,8 +369,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
@ -403,8 +395,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
ScalarConstructor[not set]{50.000000}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryArithTest, FNegate_Vector) {
@ -434,8 +425,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
struct BinaryData {
@ -1055,8 +1045,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
INSTANTIATE_TEST_SUITE_P(
@ -1201,8 +1190,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
INSTANTIATE_TEST_SUITE_P(
@ -1243,8 +1231,7 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesScalar) {
Identifier[not set]{x_2}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) {
@ -1272,8 +1259,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) {
Identifier[not set]{x_2}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) {
@ -1301,8 +1287,7 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) {
Identifier[not set]{x_2}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) {
@ -1330,8 +1315,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) {
Identifier[not set]{x_2}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) {
@ -1359,8 +1343,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) {
Identifier[not set]{x_2}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvBinaryArithTestBasic, Dot) {
@ -1390,8 +1373,7 @@ TEST_F(SpvBinaryArithTestBasic, Dot) {
)
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvBinaryArithTestBasic, OuterProduct) {

View File

@ -705,8 +705,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) {
ScalarConstructor[not set]{30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
@ -734,8 +733,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
@ -763,8 +761,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
@ -790,8 +787,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
ScalarConstructor[not set]{10}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
@ -821,8 +817,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
@ -854,8 +849,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
@ -887,8 +881,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
const auto assembly = CommonTypes() + R"(
@ -917,8 +910,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
std::string BitTestPreamble() {

View File

@ -102,8 +102,7 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) {
}
}
}
Return{})"))
<< ToString(p->builder(), fe.ast_body());
Return{})"));
}
{
@ -113,7 +112,7 @@ Return{})"))
{
ScalarConstructor[not set]{42}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
}
@ -174,8 +173,7 @@ Assignment{
Identifier[not set]{x_10}
Identifier[not set]{x_1}
}
Return{})"))
<< ToString(p->builder(), fe.ast_body());
Return{})"));
}
{
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 50));
@ -184,7 +182,7 @@ Return{})"))
{
ScalarConstructor[not set]{42}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
}

View File

@ -129,7 +129,7 @@ VariableDeclStatement{
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_Composite_Construct, Matrix) {
@ -169,8 +169,7 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_Composite_Construct, Array) {
@ -200,8 +199,7 @@ TEST_F(SpvParserTest_Composite_Construct, Array) {
ScalarConstructor[not set]{5}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_Composite_Construct, Struct) {
@ -233,8 +231,7 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) {
ScalarConstructor[not set]{30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
using SpvParserTest_CompositeExtract = SpvParserTest;
@ -266,8 +263,7 @@ TEST_F(SpvParserTest_CompositeExtract, Vector) {
Identifier[not set]{y}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_CompositeExtract, Vector_IndexTooBigError) {
@ -313,8 +309,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix) {
ScalarConstructor[not set]{2}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_CompositeExtract, Matrix_IndexTooBigError) {
@ -367,8 +362,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_Vector) {
Identifier[not set]{y}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_CompositeExtract, Array) {
@ -398,8 +392,7 @@ TEST_F(SpvParserTest_CompositeExtract, Array) {
ScalarConstructor[not set]{3}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_CompositeExtract, RuntimeArray_IsError) {
@ -450,8 +443,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct) {
Identifier[not set]{field2}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) {
@ -568,8 +560,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_Array_Matrix_Vector) {
Identifier[not set]{y}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
using SpvParserTest_CompositeInsert = SpvParserTest;
@ -1066,7 +1057,7 @@ VariableDeclStatement{
Identifier[not set]{x_1}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_CopyObject, Pointer) {
@ -1105,7 +1096,7 @@ VariableDeclStatement{
Identifier[not set]{x_1}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
using SpvParserTest_VectorShuffle = SpvParserTest;
@ -1152,7 +1143,7 @@ TEST_F(SpvParserTest_VectorShuffle, FunctionScopeOperands_UseBoth) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) {
@ -1209,8 +1200,7 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) {
@ -1241,8 +1231,7 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest_VectorShuffle, IndexTooBig_IsError) {

View File

@ -88,8 +88,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) {
ScalarConstructor[not set]{50.000000}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
@ -118,8 +117,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertSToF_BadArg) {
@ -244,8 +242,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromSigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) {
@ -273,8 +270,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) {
@ -300,8 +296,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) {
@ -329,8 +324,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_BadArgType) {
@ -391,8 +385,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromSigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) {
@ -418,8 +411,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) {
@ -447,8 +439,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) {
@ -474,8 +465,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_BadArgType) {
@ -535,8 +525,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToSigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) {
@ -564,8 +553,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) {
@ -591,8 +579,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) {
@ -620,8 +607,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_BadArgType) {
@ -683,8 +669,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToSigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) {
@ -710,8 +695,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) {
@ -739,8 +723,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) {
@ -766,8 +749,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) {
Identifier[not set]{x_30}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
// TODO(dneto): OpSConvert // only if multiple widths

View File

@ -213,8 +213,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Scalar) {
ScalarConstructor[not set]{true}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvUnaryLogicalTest, LogicalNot_Vector) {
@ -244,8 +243,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
struct BinaryData {
@ -737,8 +735,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Scalar) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordEqual_Vector) {
@ -776,8 +773,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) {
@ -807,8 +803,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) {
@ -846,8 +841,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) {
@ -877,8 +871,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordLessThan_Vector) {
@ -916,8 +909,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) {
@ -947,8 +939,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) {
@ -986,8 +977,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) {
@ -1017,8 +1007,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) {
@ -1056,8 +1045,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) {
@ -1087,8 +1075,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) {
@ -1126,8 +1113,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) {
}
}
}
})"))
<< ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, Select_BoolCond_BoolParams) {
@ -1159,7 +1145,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_BoolParams) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) {
@ -1191,7 +1177,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, Select_BoolCond_FloatScalarParams) {
@ -1223,7 +1209,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_FloatScalarParams) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) {
@ -1263,7 +1249,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) {
@ -1307,7 +1293,7 @@ TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
using SpvLogicalTest = SpvParserTestBase<::testing::Test>;
@ -1343,7 +1329,7 @@ TEST_F(SpvLogicalTest, Any) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvLogicalTest, All) {
@ -1377,7 +1363,7 @@ TEST_F(SpvLogicalTest, All) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvLogicalTest, IsNan_Scalar) {
@ -1407,7 +1393,7 @@ TEST_F(SpvLogicalTest, IsNan_Scalar) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvLogicalTest, IsNan_Vector) {
@ -1441,7 +1427,7 @@ TEST_F(SpvLogicalTest, IsNan_Vector) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvLogicalTest, IsInf_Scalar) {
@ -1471,7 +1457,7 @@ TEST_F(SpvLogicalTest, IsInf_Scalar) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvLogicalTest, IsInf_Vector) {
@ -1505,7 +1491,7 @@ TEST_F(SpvLogicalTest, IsInf_Vector) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
// TODO(dneto): Kernel-guarded instructions.

View File

@ -345,7 +345,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorSwizzle) {
Identifier[not set]{z}
}
ScalarConstructor[not set]{42}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorConstOutOfBounds) {
@ -585,7 +585,7 @@ Assignment{
Identifier[not set]{ancientness}
}
ScalarConstructor[not set]{420.000000}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTest, EmitStatement_AccessChain_StructNonConstIndex) {
@ -921,8 +921,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_Cascaded) {
ScalarConstructor[not set]{1}
}
ScalarConstructor[not set]{0}
})")) << ToString(p->builder(), fe.ast_body())
<< p->error();
})")) << p->error();
}
TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) {
@ -965,8 +964,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) {
Assignment{
Identifier[not set]{x_2}
ScalarConstructor[not set]{0}
})")) << ToString(p->builder(), fe.ast_body())
<< p->error();
})")) << p->error();
}
TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithHoisting) {
@ -1036,8 +1034,7 @@ Assignment{
ScalarConstructor[not set]{0}
}
Return{}
)")) << ToString(p->builder(), fe.ast_body())
<< p->error();
)")) << p->error();
}
TEST_F(SpvParserTest, DISABLED_RemapStorageBuffer_ThroughFunctionCall) {

View File

@ -104,7 +104,7 @@ VariableDeclStatement{
ScalarConstructor[not set]{0.000000}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTestMiscInstruction, OpUndef_BeforeFunction_Vector) {
@ -184,7 +184,7 @@ VariableDeclStatement{
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) {
@ -247,7 +247,7 @@ VariableDeclStatement{
ScalarConstructor[not set]{0.000000}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) {
@ -310,7 +310,7 @@ VariableDeclStatement{
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
@ -351,7 +351,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
@ -385,7 +385,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
@ -420,7 +420,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
}
}
}
})")) << ToString(p->builder(), fe.ast_body());
})"));
}
TEST_F(SpvParserTestMiscInstruction, OpNop) {
@ -437,7 +437,7 @@ TEST_F(SpvParserTestMiscInstruction, OpNop) {
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(p->builder(), fe.ast_body()), Eq(R"(Return{}
)")) << ToString(p->builder(), fe.ast_body());
)"));
}
// Test swizzle generation.

View File

@ -356,7 +356,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) {
}
}
}
)")) << ToString(p->builder(), fe.ast_body());
)"));
}
TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) {
@ -442,7 +442,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) {
}
}
}
)")) << ToString(p->builder(), fe.ast_body());
)"));
}
TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias) {
@ -512,7 +512,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) {
}
}
}
)")) << ToString(p->builder(), fe.ast_body());
)"));
}
TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias_Null) {
@ -547,7 +547,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias_Null) {
}
}
}
)")) << ToString(p->builder(), fe.ast_body());
)"));
}
TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
@ -587,7 +587,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
}
}
}
)")) << ToString(p->builder(), fe.ast_body());
)"));
}
TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) {
@ -627,7 +627,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) {
}
}
}
)")) << ToString(p->builder(), fe.ast_body());
)"));
}
TEST_F(SpvParserTest,