Skip to content

Commit

Permalink
Add vm test for execute
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Aug 27, 2018
1 parent 734b046 commit 13ee37a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/vmtester/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ TEST_F(evmc_vm_test, abi_version_match)
ASSERT_EQ(vm->abi_version, EVMC_ABI_VERSION);
}

TEST_F(evmc_vm_test, execute)
{
struct evmc_context context{};
struct evmc_message msg{};
std::vector<uint8_t> code({ 0xfe, 0x00 });

struct evmc_result result = vm->execute(vm, &context, EVMC_LATEST_REVISION, &msg, code.data(), code.size());

// Validate some constraints
if (result.status_code != EVMC_SUCCESS && result.status_code != EVMC_REVERT)
EXPECT_EQ(result.gas_left, 0);

if (result.output_data == NULL)
EXPECT_EQ(result.output_size, 0);

if (result.release)
result.release(&result);
}

TEST_F(evmc_vm_test, set_option_unknown)
{
if (vm->set_option)
Expand Down

0 comments on commit 13ee37a

Please sign in to comment.