[spirv-reader] Test position field of BlockInfo

Bug: tint:3
Change-Id: I746b04b545da9dcd7c0b8805f264b67cb59c8a1c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20240
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto 2020-04-23 20:15:33 +00:00
parent 0131580407
commit c7e8c9c1a9
1 changed files with 14 additions and 0 deletions

View File

@ -894,6 +894,10 @@ TEST_F(SpvParserTest, ComputeBlockOrder_OneBlock) {
fe.ComputeBlockOrderAndPositions();
EXPECT_THAT(fe.block_order(), ElementsAre(42));
const auto* bi = fe.GetBlockInfo(42);
ASSERT_NE(bi, nullptr);
EXPECT_EQ(bi->pos, 0u);
}
TEST_F(SpvParserTest, ComputeBlockOrder_IgnoreStaticalyUnreachable) {
@ -986,6 +990,16 @@ TEST_F(SpvParserTest, ComputeBlockOrder_ReorderSequence) {
fe.ComputeBlockOrderAndPositions();
EXPECT_THAT(fe.block_order(), ElementsAre(10, 20, 30));
const auto* bi10 = fe.GetBlockInfo(10);
ASSERT_NE(bi10, nullptr);
EXPECT_EQ(bi10->pos, 0u);
const auto* bi20 = fe.GetBlockInfo(20);
ASSERT_NE(bi20, nullptr);
EXPECT_EQ(bi20->pos, 1u);
const auto* bi30 = fe.GetBlockInfo(30);
ASSERT_NE(bi30, nullptr);
EXPECT_EQ(bi30->pos, 2u);
}
TEST_F(SpvParserTest, ComputeBlockOrder_DupConditionalBranch) {