Add test cases for HashTable<Material>
[purplehaze.git] / test / unit / test_hashtable.cpp
blob1125582923ea494acf584304b35692ea92035dc1
1 #include <climits>
3 #include "../../src/hashtable.h"
4 #include "gtest/gtest.h"
6 TEST(MaterialTableTest, Size)
8 HashTable<Material> ht(MT_SIZE);
10 int entry_size = sizeof(Hash) + sizeof(Material);
11 EXPECT_EQ(16, entry_size);
13 int size = MT_SIZE / entry_size;
15 // 'size' must be a power of two for HashTable<Material>::lookup()
16 EXPECT_EQ(0, size & (size - 1));
18 EXPECT_EQ(size, ht.size());