diff --git a/test/eoftest/eoftest_runner.cpp b/test/eoftest/eoftest_runner.cpp index b2645568b6..6362446163 100644 --- a/test/eoftest/eoftest_runner.cpp +++ b/test/eoftest/eoftest_runner.cpp @@ -16,6 +16,7 @@ namespace evmone::test namespace { + struct EOFValidationTest { struct Case diff --git a/test/utils/utils.cpp b/test/utils/utils.cpp new file mode 100644 index 0000000000..3c0cf284a2 --- /dev/null +++ b/test/utils/utils.cpp @@ -0,0 +1,46 @@ +// evmone: Fast Ethereum Virtual Machine implementation +// Copyright 2023 The evmone Authors. +// SPDX-License-Identifier: Apache-2.0 + +#include "utils.hpp" + +namespace evmone::test +{ + +/// Translates tests fork name to EVM revision +evmc_revision to_rev(std::string_view s) +{ + if (s == "Frontier") + return EVMC_FRONTIER; + if (s == "Homestead") + return EVMC_HOMESTEAD; + if (s == "EIP150") + return EVMC_TANGERINE_WHISTLE; + if (s == "EIP158") + return EVMC_SPURIOUS_DRAGON; + if (s == "Byzantium") + return EVMC_BYZANTIUM; + if (s == "Constantinople") + return EVMC_CONSTANTINOPLE; + if (s == "ConstantinopleFix") + return EVMC_PETERSBURG; + if (s == "Istanbul") + return EVMC_ISTANBUL; + if (s == "Berlin") + return EVMC_BERLIN; + if (s == "London") + return EVMC_LONDON; + if (s == "Merge") + return EVMC_PARIS; + if (s == "Merge+3855") // PUSH0 + return EVMC_SHANGHAI; + if (s == "Shanghai") + return EVMC_SHANGHAI; + if (s == "Cancun") + return EVMC_CANCUN; + if (s == "Prague") + return EVMC_PRAGUE; + throw std::invalid_argument{"unknown revision: " + std::string{s}}; +} + +} \ No newline at end of file diff --git a/test/utils/utils.hpp b/test/utils/utils.hpp index f0b0247052..f29e483408 100644 --- a/test/utils/utils.hpp +++ b/test/utils/utils.hpp @@ -12,6 +12,13 @@ using evmc::from_hex; using evmc::from_spaced_hex; using evmc::hex; +namespace evmone::test +{ + +evmc_revision to_rev(std::string_view s); + +} // namespace evmone::test + /// Converts a string to bytes by casting individual characters. inline bytes to_bytes(std::string_view s) { @@ -28,39 +35,3 @@ inline bytes operator""_hex(const char* s, size_t size) { return from_spaced_hex({s, size}).value(); } - -/// Translates tests fork name to EVM revision -inline evmc_revision to_rev(std::string_view s) -{ - if (s == "Frontier") - return EVMC_FRONTIER; - if (s == "Homestead") - return EVMC_HOMESTEAD; - if (s == "EIP150") - return EVMC_TANGERINE_WHISTLE; - if (s == "EIP158") - return EVMC_SPURIOUS_DRAGON; - if (s == "Byzantium") - return EVMC_BYZANTIUM; - if (s == "Constantinople") - return EVMC_CONSTANTINOPLE; - if (s == "ConstantinopleFix") - return EVMC_PETERSBURG; - if (s == "Istanbul") - return EVMC_ISTANBUL; - if (s == "Berlin") - return EVMC_BERLIN; - if (s == "London") - return EVMC_LONDON; - if (s == "Merge") - return EVMC_PARIS; - if (s == "Merge+3855") // PUSH0 - return EVMC_SHANGHAI; - if (s == "Shanghai") - return EVMC_SHANGHAI; - if (s == "Cancun") - return EVMC_CANCUN; - if (s == "Prague") - return EVMC_PRAGUE; - throw std::invalid_argument{"unknown revision: " + std::string{s}}; -}