|
@@ -180,21 +180,25 @@ static void testAddCollisions() {
|
|
|
}
|
|
|
|
|
|
static void testRemove() {
|
|
|
- // IntMap map;
|
|
|
- // map.add(1, 3).add(2, 4).add(3, 5);
|
|
|
- //
|
|
|
- // CORE_TEST_TRUE(map.remove(2));
|
|
|
- // CORE_TEST_FALSE(map.remove(7));
|
|
|
- //
|
|
|
- // int* a = coreHashMapSearch(&map,int,1);
|
|
|
- // int* b = coreHashMapSearch(&map,int,2);
|
|
|
- // int* c = coreHashMapSearch(&map,int,3);
|
|
|
- //
|
|
|
- // CORE_TEST_NULL(b);
|
|
|
- // if(CORE_TEST_NOT_NULL(a) && CORE_TEST_NOT_NULL(c)) {
|
|
|
- // CORE_TEST_EQUAL(3, *a);
|
|
|
- // CORE_TEST_EQUAL(5, *c);
|
|
|
- // }
|
|
|
+ CoreHashMap map = INT_MAP;
|
|
|
+ coreHashMapPut(&map, int, 1, int, 3);
|
|
|
+ coreHashMapPut(&map, int, 2, int, 4);
|
|
|
+ coreHashMapPut(&map, int, 3, int, 5);
|
|
|
+
|
|
|
+ CORE_TEST_TRUE(coreHashMapRemove(&map, size_t, 2));
|
|
|
+ CORE_TEST_FALSE(coreHashMapRemove(&map, size_t, 7));
|
|
|
+
|
|
|
+ int* a = coreHashMapSearch(&map, int, 1, int);
|
|
|
+ int* b = coreHashMapSearch(&map, int, 2, int);
|
|
|
+ int* c = coreHashMapSearch(&map, int, 3, int);
|
|
|
+
|
|
|
+ CORE_TEST_NULL(b);
|
|
|
+ if(CORE_TEST_NOT_NULL(a) && CORE_TEST_NOT_NULL(c)) {
|
|
|
+ CORE_TEST_INT(3, *a);
|
|
|
+ CORE_TEST_INT(5, *c);
|
|
|
+ }
|
|
|
+
|
|
|
+ coreDestroyHashMap(&map);
|
|
|
}
|
|
|
|
|
|
static void testHash() {
|