mirror of https://github.com/status-im/evmc.git
Add name and version to evmc_instance
This commit is contained in:
parent
b9771375e7
commit
630d8be405
|
@ -113,6 +113,8 @@ struct evmc_instance* examplevm_create()
|
||||||
{
|
{
|
||||||
struct evmc_instance init = {
|
struct evmc_instance init = {
|
||||||
.abi_version = EVMC_ABI_VERSION,
|
.abi_version = EVMC_ABI_VERSION,
|
||||||
|
.name = "examplevm",
|
||||||
|
.version = "0.0.0",
|
||||||
.destroy = evmc_destroy,
|
.destroy = evmc_destroy,
|
||||||
.execute = execute,
|
.execute = execute,
|
||||||
.set_option = evmc_set_option,
|
.set_option = evmc_set_option,
|
||||||
|
|
|
@ -549,6 +549,16 @@ struct evmc_instance
|
||||||
/// represented by this file is in ::EVMC_ABI_VERSION.
|
/// represented by this file is in ::EVMC_ABI_VERSION.
|
||||||
const int abi_version;
|
const int abi_version;
|
||||||
|
|
||||||
|
/// The name of the EVMC VM implementation.
|
||||||
|
///
|
||||||
|
/// It MUST be a NULL-terminated not empty string.
|
||||||
|
const char* name;
|
||||||
|
|
||||||
|
/// The version of the EVMC VM implementation, e.g. "1.2.3b4".
|
||||||
|
///
|
||||||
|
/// It MUST be a NULL-terminated not empty string.
|
||||||
|
const char* version;
|
||||||
|
|
||||||
/// Pointer to function destroying the EVM instance.
|
/// Pointer to function destroying the EVM instance.
|
||||||
evmc_destroy_fn destroy;
|
evmc_destroy_fn destroy;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "vmtester.hpp"
|
#include "vmtester.hpp"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
TEST_F(evmc_vm_test, abi_version_match)
|
TEST_F(evmc_vm_test, abi_version_match)
|
||||||
{
|
{
|
||||||
ASSERT_EQ(vm->abi_version, EVMC_ABI_VERSION);
|
ASSERT_EQ(vm->abi_version, EVMC_ABI_VERSION);
|
||||||
|
@ -27,4 +29,16 @@ TEST_F(evmc_vm_test, set_option_empty_value)
|
||||||
int r = vm->set_option(vm, "unknown_option_csk9twq", nullptr);
|
int r = vm->set_option(vm, "unknown_option_csk9twq", nullptr);
|
||||||
EXPECT_EQ(r, 0);
|
EXPECT_EQ(r, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(evmc_vm_test, name)
|
||||||
|
{
|
||||||
|
ASSERT_NE(vm->name, nullptr);
|
||||||
|
EXPECT_GT(std::strlen(vm->name), 0) << "VM name cannot be empty";
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(evmc_vm_test, version)
|
||||||
|
{
|
||||||
|
ASSERT_NE(vm->version, nullptr);
|
||||||
|
EXPECT_GT(std::strlen(vm->version), 0) << "VM name cannot be empty";
|
||||||
}
|
}
|
Loading…
Reference in New Issue