Skip to content

Commit 9482295

Browse files
committed
adding some string to hashmap test because why not
1 parent 91ccce7 commit 9482295

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

ZEngine/ZEngine/Core/Containers/HashMap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22
#include <Allocator.h>
3-
#include <Array.h>
43
#include <MemoryOperations.h>
54
#include <rapidhash.h>
65

ZEngine/tests/hashmap_test.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <Core/Containers/HashMap.h>
2+
#include <Core/Containers/Strings.h>
23
#include <gtest/gtest.h>
34
#include <string>
45

@@ -121,14 +122,20 @@ TEST_F(HashMapTest, Resize)
121122

122123
TEST_F(HashMapTest, OverwriteValue)
123124
{
124-
HashMap<int, int> map;
125+
HashMap<int, String> map;
125126
map.init(&allocator, 10, 0);
126127

127-
map.insert(1, 10);
128-
EXPECT_EQ(map[1], 10);
128+
String str1;
129+
str1.init(&allocator, "first");
129130

130-
map.insert(1, 20);
131-
EXPECT_EQ(map[1], 20);
131+
String str2;
132+
str2.init(&allocator, "updated");
133+
134+
map.insert(1, str1);
135+
EXPECT_STREQ(map[1].c_str(), str1.c_str());
136+
137+
map.insert(1, str2);
138+
EXPECT_STREQ(map[1].c_str(), str2.c_str());
132139
}
133140

134141
TEST_F(HashMapTest, CollisionHandling)

0 commit comments

Comments
 (0)