-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashmap-test.c
52 lines (40 loc) · 1.32 KB
/
hashmap-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
43
44
45
46
47
48
49
50
51
52
#include "hashmap.h"
#include <stdio.h>
int main(int argc, char **argv)
{
struct HashMap *map = constructor(10);
set("A Key", "Arb Value", map);
set("Another Key", "More data", map);
set("A Third Key", "Some Data", map);
printf("The hashmap currently looks like this:\n");
printL(map);
printf("\n");
set("A Key", "Random Data", map); //Test Collision Resolution
printf("The hashmap currently looks like this:\n");
printL(map);
printf("\n");
char* s0 = (char*) get("A Key", map); //if you actuallly want to print the data cast to char * and print
char* s1 = (char*) get("A Third Key", map);
printf("Data 1: %s Data 2: %s\n", s0, s1);
printf("\n");
char* s2 = (char*) delete("firstKeys", map);
printf("%s\n", s2);
printf("\n");
printf("The hashmap currently looks like this:\n");
printL(map);
printf("Load Factor Test: %f\n\n\n", load(map));
printf("Test functions on full hashmap strucutre\n");
set("one", "Arb Value", map);
set("two", "More data", map);
set("three", "Some Data", map);
set("four", "Arb Value", map);
set("five", "More data", map);
set("six", "Some Data", map);
set("seven", "Arb Value", map);
set("eight", "More data", map);
set("nine", "Some Data", map);
printf("The hashmap currently looks like this:\n");
printL(map);
hashFree(map);
return 0;
}