2018-04-18 16:22:24 +02:00
|
|
|
// EVMC: Ethereum Client-VM Connector API
|
2019-04-24 16:12:13 +02:00
|
|
|
// Copyright 2018-2019 The EVMC Authors.
|
|
|
|
// Licensed under the Apache License, Version 2.0.
|
2018-04-18 16:22:24 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-08-06 12:48:04 +02:00
|
|
|
#include <evmc/evmc.hpp>
|
2019-08-06 14:43:19 +02:00
|
|
|
#include <gtest/gtest.h>
|
2018-04-11 00:37:03 +02:00
|
|
|
|
|
|
|
class evmc_vm_test : public ::testing::Test
|
|
|
|
{
|
2019-07-23 14:00:12 +02:00
|
|
|
public:
|
2019-12-13 13:03:49 +01:00
|
|
|
static void set_vm(evmc::VM _owned_vm) noexcept { owned_vm = std::move(_owned_vm); }
|
2019-08-06 12:48:04 +02:00
|
|
|
|
|
|
|
protected:
|
2019-07-23 14:00:12 +02:00
|
|
|
/// The raw pointer to the loaded VM instance.
|
|
|
|
/// The C API is used to allow more sophisticated unit tests.
|
2019-12-13 13:03:49 +01:00
|
|
|
evmc_vm* vm = nullptr;
|
2018-04-11 00:37:03 +02:00
|
|
|
|
2019-08-06 12:48:04 +02:00
|
|
|
/// The C++ RAII wrapper of the loaded VM instance.
|
2019-04-24 19:03:00 +02:00
|
|
|
static evmc::VM owned_vm;
|
2019-08-06 12:48:04 +02:00
|
|
|
|
2019-12-13 13:03:49 +01:00
|
|
|
evmc_vm_test() : vm{owned_vm.get_raw_pointer()} {}
|
|
|
|
|
2019-07-23 14:00:12 +02:00
|
|
|
void SetUp() override { ASSERT_TRUE(vm != nullptr) << "VM instance not loaded"; }
|
2018-04-11 00:37:03 +02:00
|
|
|
};
|