-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
42 lines (34 loc) · 1.1 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdlib.h>
#include <stdio.h>
#include "simple_hashmap.h"
int main(int argc, char const *argv[])
{
hashmap* map = create_hashmap(1000);
char key1[] = "aaa";
char val1[] = "123";
char key2[] = "bbb";
char val2[] = "121";
char key3[] = "ccc";
char val3[] = "111";
char key4[] = "ddd";
char val4[] = "133";
char key5[] = "aaa";
char val5[] = "555";
char key6[] = "zzz";
char val6[] = "999";
hashmap_insert(map, key1, 3, (void*)val1, 4);
hashmap_insert(map, key2, 3, (void*)val2, 4);
hashmap_insert(map, key3, 3, (void*)val3, 4);
hashmap_insert(map, key4, 3, (void*)val4, 4);
hashmap_insert(map, key5, 3, (void*)val5, 4);
hashmap_insert(map, key6, 3, (void*)val6, 4);
printf("%d\n", hashmap_count(map));
hashmap_remove(map, "zzz", 3);
printf("%d\n", hashmap_count(map));
printf("%s\n", (char*)hashmap_get(map, "ddd",3));
printf("%s\n", (char*)hashmap_get(map, "ccc",3));
printf("%s\n", (char*)hashmap_get(map, "aaa",3));
printf("%s\n", (char*)hashmap_get(map, "bbb",3));
free_hashmap(map);
return 0;
}