attempt to make test green

This commit is contained in:
andri lim 2019-12-16 22:04:10 +07:00
parent e2b88bbc0b
commit 9af19a284c
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 6 additions and 9 deletions

View File

@ -17,7 +17,8 @@
#include <stdlib.h>
#include <string.h>
extern "C" {
/// The example VM instance struct extending the evmc_vm.
struct example_vm
{
@ -225,8 +226,10 @@ struct evmc_vm* evmc_create_example_vm()
.get_capabilities = get_capabilities,
.set_option = set_option,
};
struct example_vm* vm = calloc(1, sizeof(struct example_vm));
struct example_vm* vm = (example_vm*)calloc(1, sizeof(struct example_vm));
struct evmc_vm* interface = &vm->instance;
memcpy(interface, &init, sizeof(init));
return interface;
}
}

View File

@ -3,7 +3,7 @@ import evmc_nim/nim_host
import stew/byteutils
{.compile: "evmc_c/example_host.cpp".}
{.compile: "evmc_c/example_vm.c".}
{.compile: "evmc_c/example_vm.cpp".}
{.passL: "-lstdc++"}
when defined(posix):
@ -62,12 +62,6 @@ template runTest(testName: string, create_vm, get_host_interface, create_host_co
test "getTxContext":
let txc = hc.getTxContext()
debugEcho tx_context.block_number, " " , txc.block_number
debugEcho tx_context.block_timestamp, " " , txc.block_timestamp
debugEcho tx_context.block_gas_limit, " " , txc.block_gas_limit
check tx_context.block_number == txc.block_number
check tx_context.block_timestamp == txc.block_timestamp
check tx_context.block_gas_limit == txc.block_gas_limit