mirror of https://github.com/status-im/evmc.git
Add unit tests for "evmc_create()"
This commit is contained in:
parent
8006ef86c2
commit
391a300d08
|
@ -5,6 +5,10 @@
|
|||
add_library(vm-mock SHARED vm_mock.c)
|
||||
target_link_libraries(vm-mock PRIVATE evmc)
|
||||
|
||||
add_library(vm-mock-default SHARED vm_mock_default.c)
|
||||
target_link_libraries(vm-mock-default PRIVATE evmc)
|
||||
|
||||
|
||||
if(UNIX)
|
||||
set(cmd create_symlink)
|
||||
else()
|
||||
|
@ -13,6 +17,7 @@ endif()
|
|||
|
||||
add_custom_command(
|
||||
TARGET vm-mock POST_BUILD
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E ${cmd} $<TARGET_FILE:vm-mock> libaaa.so
|
||||
COMMAND ${CMAKE_COMMAND} -E ${cmd} $<TARGET_FILE:vm-mock> double_prefix_aaa.evm
|
||||
COMMAND ${CMAKE_COMMAND} -E ${cmd} $<TARGET_FILE:vm-mock> double-prefix-aaa.evm
|
||||
|
@ -26,6 +31,9 @@ add_custom_command(
|
|||
COMMAND ${CMAKE_COMMAND} -E ${cmd} $<TARGET_FILE:vm-mock> ../aaa.evm
|
||||
COMMAND ${CMAKE_COMMAND} -E ${cmd} $<TARGET_FILE:vm-mock> failure.vm
|
||||
COMMAND ${CMAKE_COMMAND} -E ${cmd} $<TARGET_FILE:vm-mock> abi42.vm
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E ${cmd} $<TARGET_FILE:vm-mock-default> default.evmc
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E touch empty.file
|
||||
)
|
||||
|
||||
|
|
|
@ -245,6 +245,19 @@ TEST(loader, lib_)
|
|||
EXPECT_EQ(x, nullptr);
|
||||
}
|
||||
|
||||
TEST(loader, load_default)
|
||||
{
|
||||
auto path = "unittests/default.evmc";
|
||||
|
||||
evmc_loader_error_code ec;
|
||||
auto fn = evmc_load(path, &ec);
|
||||
EXPECT_EQ(ec, EVMC_LOADER_SUCCESS);
|
||||
EXPECT_EQ((uintptr_t)fn(), 0xdeaf);
|
||||
|
||||
fn = evmc_load(path, nullptr);
|
||||
EXPECT_EQ((uintptr_t)fn(), 0xdeaf);
|
||||
}
|
||||
|
||||
TEST(loader, load_and_create_failure)
|
||||
{
|
||||
evmc_loader_error_code ec;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
/* EVMC: Ethereum Client-VM Connector API.
|
||||
* Copyright 2018 The EVMC Authors.
|
||||
* Licensed under the Apache License, Version 2.0. See the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <evmc/utils.h>
|
||||
|
||||
EVMC_EXPORT void* evmc_create()
|
||||
{
|
||||
return (void*)0xdeaf;
|
||||
}
|
Loading…
Reference in New Issue