Skip to content

Commit

Permalink
Merge pull request #73 from ethereum/tests
Browse files Browse the repository at this point in the history
test: Add unit tests for PC
  • Loading branch information
chfast committed Jun 24, 2019
2 parents 019517b + f1cba8e commit 7c0d019
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unittests/execution_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,20 @@ TEST_F(execution, bad_jumpdest)
}
}

TEST_F(execution, pc)
{
const auto code = OP_CALLDATASIZE + push(9) + OP_JUMPI + push(12) + OP_PC + OP_SWAP1 + OP_JUMP +
OP_JUMPDEST + OP_GAS + OP_PC + OP_JUMPDEST + ret_top();

execute(code, "");
EXPECT_STATUS(EVMC_SUCCESS);
EXPECT_OUTPUT_INT(6);

execute(code, "ff");
EXPECT_STATUS(EVMC_SUCCESS);
EXPECT_OUTPUT_INT(11);
}

TEST_F(execution, byte)
{
std::string s;
Expand Down

0 comments on commit 7c0d019

Please sign in to comment.