mirror of
https://github.com/status-im/evmc.git
synced 2025-02-23 08:28:15 +00:00
test: Rework tests for 32-bit architectures support
This commit is contained in:
parent
52689e049e
commit
4381f339d4
@ -17,7 +17,8 @@ static_assert(sizeof(evmc_bytes32) == 32, "evmc_bytes32 is too big");
|
||||
static_assert(sizeof(evmc_address) == 20, "evmc_address is too big");
|
||||
static_assert(sizeof(evmc_result) <= 64, "evmc_result does not fit cache line");
|
||||
static_assert(sizeof(evmc_instance) <= 64, "evmc_instance does not fit cache line");
|
||||
static_assert(offsetof(evmc_message, value) % 8 == 0, "evmc_message.value not aligned");
|
||||
static_assert(offsetof(evmc_message, value) % sizeof(size_t) == 0,
|
||||
"evmc_message.value not aligned");
|
||||
|
||||
// Check enums match int size.
|
||||
// On GCC/clang the underlying type should be unsigned int, on MSVC int
|
||||
@ -27,7 +28,8 @@ static_assert(sizeof(evmc_revision) == sizeof(int), "Enum `evmc_revision` is not
|
||||
|
||||
static constexpr size_t optionalDataSize =
|
||||
sizeof(evmc_result) - offsetof(evmc_result, create_address);
|
||||
static_assert(optionalDataSize == sizeof(evmc_result_optional_storage), "");
|
||||
static_assert(optionalDataSize >= sizeof(evmc_result_optional_storage),
|
||||
"evmc_result's optional data space is too small");
|
||||
|
||||
|
||||
TEST(helpers, fnv1a)
|
||||
|
@ -37,13 +37,13 @@ TEST_F(evmc_vm_test, abi_version_match)
|
||||
TEST_F(evmc_vm_test, name)
|
||||
{
|
||||
ASSERT_TRUE(vm->name != nullptr);
|
||||
EXPECT_GT(std::strlen(vm->name), 0) << "VM name cannot be empty";
|
||||
EXPECT_NE(std::strlen(vm->name), size_t{0}) << "VM name cannot be empty";
|
||||
}
|
||||
|
||||
TEST_F(evmc_vm_test, version)
|
||||
{
|
||||
ASSERT_TRUE(vm->version != nullptr);
|
||||
EXPECT_GT(std::strlen(vm->version), 0) << "VM name cannot be empty";
|
||||
EXPECT_NE(std::strlen(vm->version), size_t{0}) << "VM version cannot be empty";
|
||||
}
|
||||
|
||||
TEST_F(evmc_vm_test, capabilities)
|
||||
@ -69,13 +69,13 @@ TEST_F(evmc_vm_test, execute_call)
|
||||
EXPECT_EQ(result.gas_left, 0);
|
||||
}
|
||||
|
||||
if (result.output_data == NULL)
|
||||
if (result.output_data == nullptr)
|
||||
{
|
||||
EXPECT_EQ(result.output_size, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_NE(result.output_size, 0);
|
||||
EXPECT_NE(result.output_size, size_t{0});
|
||||
read_buffer(result.output_data, result.output_size);
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ TEST_F(evmc_vm_test, execute_create)
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_NE(result.output_size, 0);
|
||||
EXPECT_NE(result.output_size, size_t{0});
|
||||
read_buffer(result.output_data, result.output_size);
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ TEST_F(evmc_vm_test, precompile_test)
|
||||
destination.bytes[19] = static_cast<uint8_t>(i & 0xff);
|
||||
|
||||
evmc_message msg{
|
||||
EVMC_CALL, 0, 0, 65536, destination, evmc_address{}, NULL, 0, evmc_uint256be{},
|
||||
EVMC_CALL, 0, 0, 65536, destination, evmc_address{}, nullptr, 0, evmc_uint256be{},
|
||||
evmc_bytes32{}};
|
||||
|
||||
evmc_result result = vm->execute(vm, nullptr, EVMC_MAX_REVISION, &msg, nullptr, 0);
|
||||
@ -201,13 +201,13 @@ TEST_F(evmc_vm_test, precompile_test)
|
||||
EXPECT_EQ(result.gas_left, 0);
|
||||
}
|
||||
|
||||
if (result.output_data == NULL)
|
||||
if (result.output_data == nullptr)
|
||||
{
|
||||
EXPECT_EQ(result.output_size, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_NE(result.output_size, 0);
|
||||
EXPECT_NE(result.output_size, size_t{0});
|
||||
read_buffer(result.output_data, result.output_size);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user