Merge pull request #479 from ethereum/unittests

Unit test on the move
This commit is contained in:
Paweł Bylica 2019-12-05 09:58:51 +01:00 committed by GitHub
commit ef5a2c1ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 18 deletions

View File

@ -16,11 +16,12 @@ target_compile_definitions(loader-mocked PRIVATE EVMC_LOADER_MOCK=1)
add_executable(
evmc-unittests
cpp_test.cpp
helpers_test.cpp
instructions_test.cpp
loader_mock.h
test_cpp.cpp
test_helpers.cpp
test_instructions.cpp
test_loader.cpp
loader_test.cpp
mocked_host_test.cpp
)
target_link_libraries(

View File

@ -634,17 +634,3 @@ TEST(cpp, result_create)
EXPECT_TRUE(std::memcmp(c.output_data, r.output_data, c.output_size) == 0);
c.release(&c);
}
TEST(cpp, mocked_account)
{
using namespace evmc::literals;
evmc::MockedAccount account;
EXPECT_EQ(account.nonce, 0);
--account.nonce;
account.set_balance(0x0102030405060708);
EXPECT_EQ(account.balance,
0x0000000000000000000000000000000000000000000000000102030405060708_bytes32);
EXPECT_EQ(account.nonce, -1);
}

View File

@ -0,0 +1,20 @@
// EVMC: Ethereum Client-VM Connector API.
// Copyright 2019 The EVMC Authors.
// Licensed under the Apache License, Version 2.0.
#include <evmc/mocked_host.hpp>
#include <gtest/gtest.h>
TEST(mocked_host, mocked_account)
{
using namespace evmc::literals;
evmc::MockedAccount account;
EXPECT_EQ(account.nonce, 0);
--account.nonce;
account.set_balance(0x0102030405060708);
EXPECT_EQ(account.balance,
0x0000000000000000000000000000000000000000000000000102030405060708_bytes32);
EXPECT_EQ(account.nonce, -1);
}