Skip to content

Commit

Permalink
test: Drop vm_loader.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Oct 16, 2020
1 parent 0596f06 commit c292236
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ find_package(GTest CONFIG REQUIRED)
add_executable(evmone-unittests
analysis_test.cpp
bytecode_test.cpp
evm_fixture.cpp
evm_fixture.hpp
evm_test.cpp
evm_calls_test.cpp
Expand All @@ -17,7 +18,6 @@ add_executable(evmone-unittests
evmone_test.cpp
op_table_test.cpp
utils_test.cpp
vm_loader_evmone.cpp
)
target_link_libraries(evmone-unittests PRIVATE evmone testutils evmc::instructions GTest::gtest GTest::gtest_main)
target_include_directories(evmone-unittests PRIVATE ${evmone_private_include_dir})
Expand Down
4 changes: 2 additions & 2 deletions test/unittests/evm_calls_test.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// evmone: Fast Ethereum Virtual Machine implementation
// Copyright 2019 The evmone Authors.
// Copyright 2019-2020 The evmone Authors.
// SPDX-License-Identifier: Apache-2.0

/// This file contains EVM unit tests that perform any kind of calls.

#include "evm_fixture.hpp"

using namespace evmc::literals;
using evm_calls = evm;
using evm_calls = evmone::test::evm;

TEST_F(evm_calls, delegatecall)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// evmone: Fast Ethereum Virtual Machine implementation
// Copyright 2019 The evmone Authors.
// Copyright 2019-2020 The evmone Authors.
// SPDX-License-Identifier: Apache-2.0

#include "vm_loader.hpp"
#include "evm_fixture.hpp"
#include <evmone/evmone.h>

namespace evmone::test
{
evmc::VM& get_vm() noexcept
{
static auto vm = evmc::VM{evmc_create_evmone()};
return vm;
}
} // namespace evmone::test
10 changes: 7 additions & 3 deletions test/unittests/evm_fixture.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// evmone: Fast Ethereum Virtual Machine implementation
// Copyright 2019 The evmone Authors.
// Copyright 2019-2020 The evmone Authors.
// SPDX-License-Identifier: Apache-2.0
#pragma once

#include "vm_loader.hpp"

#include <evmc/mocked_host.hpp>
#include <gtest/gtest.h>
#include <intx/intx.hpp>
Expand All @@ -27,6 +25,11 @@
EXPECT_EQ(hex({result.output_data, result.output_size}), \
hex({intx::be::store<evmc_bytes32>(intx::uint256{X}).bytes, sizeof(evmc_bytes32)}))


namespace evmone::test
{
evmc::VM& get_vm() noexcept;

/// The "evm" test fixture with generic unit tests for EVMC-compatible VM implementations.
class evm : public testing::Test
{
Expand Down Expand Up @@ -97,3 +100,4 @@ class evm : public testing::Test
execute({code.data(), code.size()}, input_hex);
}
};
} // namespace evmone::test
5 changes: 2 additions & 3 deletions test/unittests/evm_other_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// evmone: Fast Ethereum Virtual Machine implementation
// Copyright 2019 The evmone Authors.
// Copyright 2019-2020 The evmone Authors.
// SPDX-License-Identifier: Apache-2.0

/// This file contains non-mainstream EVM unit tests not matching any concrete category:
Expand All @@ -8,10 +8,9 @@
/// - evmone's internal tests.

#include "evm_fixture.hpp"

#include <evmone/limits.hpp>

using evm_other = evm;
using evm_other = evmone::test::evm;

TEST_F(evm_other, evmone_loaded_program_relocation)
{
Expand Down
4 changes: 2 additions & 2 deletions test/unittests/evm_state_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// evmone: Fast Ethereum Virtual Machine implementation
// Copyright 2019 The evmone Authors.
// Copyright 2019-2020 The evmone Authors.
// SPDX-License-Identifier: Apache-2.0

/// This file contains EVM unit tests that access or modify Ethereum state
Expand All @@ -8,7 +8,7 @@
#include "evm_fixture.hpp"

using namespace evmc::literals;
using evm_state = evm;
using evm_state = evmone::test::evm;

TEST_F(evm_state, code)
{
Expand Down
3 changes: 2 additions & 1 deletion test/unittests/evm_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// evmone: Fast Ethereum Virtual Machine implementation
// Copyright 2019 The evmone Authors.
// Copyright 2019-2020 The evmone Authors.
// SPDX-License-Identifier: Apache-2.0

#include "evm_fixture.hpp"
Expand All @@ -11,6 +11,7 @@

using namespace evmc::literals;
using namespace intx;
using evmone::test::evm;

TEST_F(evm, empty)
{
Expand Down
8 changes: 0 additions & 8 deletions test/unittests/vm_loader.hpp

This file was deleted.

0 comments on commit c292236

Please sign in to comment.