mirror of https://github.com/status-im/evmc.git
test: Move an unit test from "helpers" to "cpp"
This commit is contained in:
parent
6b46dfb7b0
commit
279c1cd6e7
|
@ -14,6 +14,8 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
TEST(cpp, address)
|
||||
|
@ -83,6 +85,31 @@ TEST(cpp, std_hash)
|
|||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
TEST(cpp, std_maps)
|
||||
{
|
||||
std::map<evmc::address, bool> addresses;
|
||||
addresses[{}] = true;
|
||||
ASSERT_EQ(addresses.size(), 1);
|
||||
EXPECT_EQ(addresses.begin()->first, evmc::address{});
|
||||
|
||||
std::unordered_map<evmc::address, bool> unordered_addresses;
|
||||
unordered_addresses.emplace(*addresses.begin());
|
||||
addresses.clear();
|
||||
EXPECT_EQ(unordered_addresses.size(), 1);
|
||||
EXPECT_FALSE(unordered_addresses.begin()->first);
|
||||
|
||||
std::map<evmc::bytes32, bool> storage;
|
||||
storage[{}] = true;
|
||||
ASSERT_EQ(storage.size(), 1);
|
||||
EXPECT_EQ(storage.begin()->first, evmc::bytes32{});
|
||||
|
||||
std::unordered_map<evmc::bytes32, bool> unordered_storage;
|
||||
unordered_storage.emplace(*storage.begin());
|
||||
storage.clear();
|
||||
EXPECT_EQ(unordered_storage.size(), 1);
|
||||
EXPECT_FALSE(unordered_storage.begin()->first);
|
||||
}
|
||||
|
||||
TEST(cpp, address_comparison)
|
||||
{
|
||||
const auto zero = evmc::address{};
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
// Compile time checks:
|
||||
|
||||
static_assert(sizeof(evmc_bytes32) == 32, "evmc_bytes32 is too big");
|
||||
|
@ -39,25 +35,6 @@ TEST(helpers, fnv1a)
|
|||
EXPECT_EQ(h, sizeof(size_t) == 8 ? 0x15e05d6d22fed89a : 0xffaa6a9a);
|
||||
}
|
||||
|
||||
TEST(helpers, maps)
|
||||
{
|
||||
std::map<evmc_address, bool> addresses;
|
||||
addresses[{}] = true;
|
||||
ASSERT_EQ(addresses.size(), 1);
|
||||
|
||||
std::unordered_map<evmc_address, bool> unordered_addresses;
|
||||
unordered_addresses.emplace(*addresses.begin());
|
||||
EXPECT_EQ(unordered_addresses.size(), 1);
|
||||
|
||||
std::map<evmc_bytes32, bool> storage;
|
||||
storage[{}] = true;
|
||||
ASSERT_EQ(storage.size(), 1);
|
||||
|
||||
std::unordered_map<evmc_bytes32, bool> unordered_storage;
|
||||
unordered_storage.emplace(*storage.begin());
|
||||
EXPECT_EQ(unordered_storage.size(), 1);
|
||||
}
|
||||
|
||||
TEST(helpers, is_zero)
|
||||
{
|
||||
auto a = evmc_address{};
|
||||
|
|
Loading…
Reference in New Issue