blob: ba3562500bde646f85b870f49de81265e2e298a9 [file] [log] [blame]
Zane Shelley72b755f2022-01-18 17:06:22 -06001#include <hei_util.hpp>
2
3#include "gtest/gtest.h"
4
5using namespace libhei;
6
7TEST(UtilHash, TestSet1)
8{
9 std::string s{"SOME_RANDOM_STRING"};
10
11 uint8_t h1 = 0xBE;
12 uint16_t h2 = 0xF2DD;
13 uint32_t h3 = 0xDFB31440;
14 uint64_t h4 = 0xD0D3828Ec49F687C;
15 NodeId_t h5 = 0xF2DD; // 2-byte field
16 RegisterId_t h6 = static_cast<RegisterId_t>(0x31D080); // 3-byte field
17
18 EXPECT_EQ(h1, hash<uint8_t>(s));
19 EXPECT_EQ(h2, hash<uint16_t>(s));
20 EXPECT_EQ(h3, hash<uint32_t>(s));
21 EXPECT_EQ(h4, hash<uint64_t>(s));
22 EXPECT_EQ(h5, hash<NodeId_t>(s));
23 EXPECT_EQ(h6, hash<RegisterId_t>(s));
24}