test: Move MockedHost's unit tests to own file

This commit is contained in:
Paweł Bylica 2019-12-04 22:57:50 +01:00
parent 60788f9a20
commit 0c9029bddc
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
3 changed files with 21 additions and 14 deletions

View File

@ -21,6 +21,7 @@ add_executable(
instructions_test.cpp
loader_mock.h
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);
}