Skip to content

Commit

Permalink
fixup system_call unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Feb 2, 2024
1 parent 66139bb commit 3f608b1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/unittests/state_system_call_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ using namespace evmone::state;
TEST(state_system_call, non_existient)
{
evmc::VM vm;
evmone::test::TestState ts;
State state{ts};
evmone::test::TestState state;

system_call(state, {}, EVMC_CANCUN, vm);
const auto diff = system_call(state, {}, EVMC_CANCUN, vm);

Check warning on line 19 in test/unittests/state_system_call_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_system_call_test.cpp#L19

Added line #L19 was not covered by tests

EXPECT_EQ(state.get_accounts().size(), 0);
EXPECT_EQ(diff.modified_accounts.size(), 0);
EXPECT_EQ(diff.modified_storage.size(), 0);

Check warning on line 22 in test/unittests/state_system_call_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_system_call_test.cpp#L21-L22

Added lines #L21 - L22 were not covered by tests
}

TEST(state_system_call, sstore_timestamp)
Expand All @@ -29,16 +29,16 @@ TEST(state_system_call, sstore_timestamp)
evmc::VM vm{evmc_create_evmone()};
const BlockInfo block{.number = 1, .timestamp = 404};

evmone::test::TestState ts;
State state{ts};
evmone::test::TestState state;
state.insert(BeaconRootsAddress, {.code = sstore(OP_NUMBER, OP_TIMESTAMP)});

system_call(state, block, EVMC_CANCUN, vm);
const auto diff = system_call(state, block, EVMC_CANCUN, vm);
state.apply_diff(diff);

Check warning on line 36 in test/unittests/state_system_call_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_system_call_test.cpp#L35-L36

Added lines #L35 - L36 were not covered by tests

ASSERT_EQ(state.get_accounts().size(), 1);
EXPECT_EQ(state.get(BeaconRootsAddress).nonce, 0);
EXPECT_EQ(state.get(BeaconRootsAddress).balance, 0);
const auto& storage = state.get(BeaconRootsAddress).storage;
ASSERT_EQ(storage.size(), 1);
EXPECT_EQ(storage.at(0x01_bytes32).current, 404);
EXPECT_EQ(storage.at(0x01_bytes32), 404);

Check warning on line 43 in test/unittests/state_system_call_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_system_call_test.cpp#L43

Added line #L43 was not covered by tests
}

0 comments on commit 3f608b1

Please sign in to comment.