11 #include <gtest/gtest.h> 28 mrpt::utils::ts_hash_map<std::string, double> m;
30 EXPECT_TRUE(m.empty());
33 EXPECT_FALSE(m.empty());
35 EXPECT_TRUE(m.empty());
41 EXPECT_EQ(1.0, m[
"uno"]);
42 EXPECT_EQ(2.0, m[
"dos"]);
43 EXPECT_EQ(3.0, m[
"tres"]);
46 EXPECT_EQ(4.0, m[
"tres"])
47 <<
"Fail after ++ operator applied to reference [].";
50 for (
const auto& e : m)
num += e.second;
51 EXPECT_NEAR(
num, 7.0, 1e-10)
52 <<
"Fail after visiting and summing all entries";
55 const auto& it = m.find(
"pepe");
56 EXPECT_TRUE(it == m.end());
60 const auto& it = m.find(
"uno");
61 EXPECT_TRUE(it->second == 1.0);
void simple_test_hash_string()
ts_hash_map()
< Default constructor */
TEST(ts_hash_map, string_hash_u8)
void reduced_hash(const std::string &value, uint8_t &hash)
hash function used by ts_hash_map.