17 #include <HashMap.hpp>
21 #include <BaseString.hpp>
24 struct NodePair { Uint32 node1; Uint32 node2; };
31 printf(
"int -> int\n");
34 for (
int i= 0;
i < 100;
i++)
35 OK(hash1.insert(
i,
i*34));
38 for (
int i= 0;
i < 100;
i++)
40 OK(hash1.search(
i, int_val));
43 OK(!hash1.search(
i+100, int_val));
47 OK(!hash1.insert(32, 32));
50 OK(hash1.search(32, int_val));
54 OK(hash1.insert(32, 37,
true));
57 OK(hash1.search(32, int_val));
62 printf(
"int -> BaseString\n");
68 OK(hash2.insert(32, str1));
72 OK(hash2.search(32, str2));
76 OK(!hash2.search(33, str2));
78 for (
int i= 100;
i < 200;
i++){
81 OK(hash2.insert(
i, str));
84 for (
int i= 100;
i < 200;
i++){
86 OK(hash2.search(
i, str));
90 for (
int i= 100;
i < 200;
i+=2)
94 OK(!hash2.search(102, str3));
95 OK(hash2.search(103, str3));
98 printf(
"struct NodePair -> Uint32\n");
104 OK(lookup.insert(pk, 37));
107 OK(!lookup.insert(pk, 38));
110 OK(lookup.search(pk, value));
114 printf(
"BaseString -> int\n");
117 OK(string_hash.insert(
"magnus", 1));
118 OK(string_hash.insert(
"mas", 2));
120 OK(string_hash.search(
"mas", value));
123 OK(string_hash.entries() == 2);
126 OK(string_hash.remove(
"mas"));
129 OK(!string_hash.search(
"mas", value));
131 OK(string_hash.entries() == 1);