Skip to content

Commit

Permalink
Unit tests fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Nov 24, 2022
1 parent 4b8ee8c commit c6690ee
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/unittests/instructions_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ TEST(instructions, shanghai_hard_fork)
{
if (op == OP_PUSH0)
continue;
if (op == OP_DUPN)
continue;
if (op == OP_SWAPN)
continue;
EXPECT_EQ(s[op], p[op]) << op;
EXPECT_STREQ(sn[op], pn[op]) << op;
}
Expand All @@ -393,4 +397,20 @@ TEST(instructions, shanghai_hard_fork)
EXPECT_EQ(p[OP_PUSH0].gas_cost, 0);
EXPECT_EQ(sn[OP_PUSH0], std::string{"PUSH0"});
EXPECT_TRUE(pn[OP_PUSH0] == nullptr);

// EIP-663: DUPN instruction
EXPECT_EQ(s[OP_DUPN].gas_cost, 3);
EXPECT_EQ(s[OP_DUPN].stack_height_required, 0);
EXPECT_EQ(s[OP_DUPN].stack_height_change, 1);
EXPECT_EQ(p[OP_DUPN].gas_cost, 0);
EXPECT_EQ(sn[OP_DUPN], std::string{"DUPN"});
EXPECT_TRUE(pn[OP_DUPN] == nullptr);

// EIP-663: SWAPN instruction
EXPECT_EQ(s[OP_SWAPN].gas_cost, 3);
EXPECT_EQ(s[OP_SWAPN].stack_height_required, 0);
EXPECT_EQ(s[OP_SWAPN].stack_height_change, 0);
EXPECT_EQ(p[OP_SWAPN].gas_cost, 0);
EXPECT_EQ(sn[OP_SWAPN], std::string{"SWAPN"});
EXPECT_TRUE(pn[OP_SWAPN] == nullptr);
}

0 comments on commit c6690ee

Please sign in to comment.