Skip to content

Commit

Permalink
test: Refactor some analysis unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 11, 2019
1 parent 3277e4d commit dd738dc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/unittests/analysis_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ TEST(analysis, example1)
EXPECT_EQ(analysis.instrs[6].fn, op_table[OP_SSTORE]);
EXPECT_EQ(analysis.instrs[7].fn, op_table[OP_STOP]);

EXPECT_EQ(analysis.instrs[0].arg.block.gas_cost, 14);
EXPECT_EQ(analysis.instrs[0].arg.block.stack_req, 0);
EXPECT_EQ(analysis.instrs[0].arg.block.stack_max_growth, 2);
const auto& block = analysis.instrs[0].arg.block;
EXPECT_EQ(block.gas_cost, 14);
EXPECT_EQ(block.stack_req, 0);
EXPECT_EQ(block.stack_max_growth, 2);
}

TEST(analysis, stack_up_and_down)
Expand All @@ -46,10 +47,10 @@ TEST(analysis, stack_up_and_down)
EXPECT_EQ(analysis.instrs[8].fn, op_table[OP_POP]);
EXPECT_EQ(analysis.instrs[18].fn, op_table[OP_PUSH1]);


EXPECT_EQ(analysis.instrs[0].arg.block.gas_cost, 7 * 3 + 10 * 2 + 3);
EXPECT_EQ(analysis.instrs[0].arg.block.stack_req, 3);
EXPECT_EQ(analysis.instrs[0].arg.block.stack_max_growth, 7);
const auto& block = analysis.instrs[0].arg.block;
EXPECT_EQ(block.gas_cost, 7 * 3 + 10 * 2 + 3);
EXPECT_EQ(block.stack_req, 3);
EXPECT_EQ(block.stack_max_growth, 7);
}

TEST(analysis, push)
Expand Down

0 comments on commit dd738dc

Please sign in to comment.