Lines Matching full:hash
32 static void _put(UHashtable* hash,
37 static void _get(UHashtable* hash,
41 static void _remove(UHashtable* hash,
106 UHashtable *hash; in TestBasic() local
108 hash = uhash_open(hashChars, isEqualChars, NULL, &status); in TestBasic()
111 u_errorName(status), hash); in TestBasic()
114 if (hash == NULL) { in TestBasic()
118 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in TestBasic()
120 _put(hash, one, 1, 0); in TestBasic()
121 _put(hash, omega, 24, 0); in TestBasic()
122 _put(hash, two, 2, 0); in TestBasic()
123 _put(hash, three, 3, 0); in TestBasic()
124 _put(hash, one, -1, 1); in TestBasic()
125 _put(hash, two, -2, 2); in TestBasic()
126 _put(hash, omega, 48, 24); in TestBasic()
127 _put(hash, one, 100, -1); in TestBasic()
128 _get(hash, three, 3); in TestBasic()
129 _remove(hash, two, -2); in TestBasic()
130 _get(hash, two, 0); in TestBasic()
131 _get(hash, one, 100); in TestBasic()
132 _put(hash, two, 200, 0); in TestBasic()
133 _get(hash, omega, 48); in TestBasic()
134 _get(hash, two, 200); in TestBasic()
149 uhash_close(hash); in TestBasic()
156 UHashtable *hash; in TestOtherAPI() local
168 hash = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status); in TestOtherAPI()
171 u_errorName(status), hash); in TestOtherAPI()
174 if (hash == NULL) { in TestOtherAPI()
178 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in TestOtherAPI()
180 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
181 if(uhash_count(hash) != 1){ in TestOtherAPI()
182 log_err("FAIL: uhas_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
184 if(uhash_find(hash, (void*)two) != NULL){ in TestOtherAPI()
187 uhash_puti(hash, (void*)two, 2, &status); in TestOtherAPI()
188 uhash_puti(hash, (void*)three, 3, &status); in TestOtherAPI()
189 uhash_puti(hash, (void*)four, 4, &status); in TestOtherAPI()
190 uhash_puti(hash, (void*)five, 5, &status); in TestOtherAPI()
192 if(uhash_count(hash) != 5){ in TestOtherAPI()
193 log_err("FAIL: uhas_count() failed. Expected: 5, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
196 if(uhash_geti(hash, (void*)two2) != 2){ in TestOtherAPI()
200 if(uhash_find(hash, (void*)two2) == NULL){ in TestOtherAPI()
204 if(uhash_removei(hash, (void*)five2) != 5){ in TestOtherAPI()
207 if(uhash_count(hash) != 4){ in TestOtherAPI()
208 log_err("FAIL: uhas_count() failed. Expected: 4, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
211 uhash_put(hash, (void*)one, NULL, &status); in TestOtherAPI()
212 if(uhash_count(hash) != 3){ in TestOtherAPI()
216 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
217 if(uhash_count(hash) != 3){ in TestOtherAPI()
222 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
223 if(uhash_count(hash) != 4){ in TestOtherAPI()
234 uhash_removeAll(hash); in TestOtherAPI()
235 if(uhash_count(hash) != 0){ in TestOtherAPI()
236 log_err("FAIL: uhas_count() failed. Expected: 0, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
239 uhash_setKeyComparator(hash, uhash_compareLong); in TestOtherAPI()
240 uhash_setKeyHasher(hash, uhash_hashLong); in TestOtherAPI()
241 uhash_iputi(hash, 1001, 1, &status); in TestOtherAPI()
242 uhash_iputi(hash, 1002, 2, &status); in TestOtherAPI()
243 uhash_iputi(hash, 1003, 3, &status); in TestOtherAPI()
251 uhash_setResizePolicy(hash, U_GROW_AND_SHRINK); in TestOtherAPI()
252 uhash_iputi(hash, 1004, 4, &status); in TestOtherAPI()
253 uhash_iputi(hash, 1005, 5, &status); in TestOtherAPI()
254 uhash_iputi(hash, 1006, 6, &status); in TestOtherAPI()
255 if(uhash_count(hash) != 6){ in TestOtherAPI()
256 log_err("FAIL: uhash_count() failed. Expected: 6, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
258 if(uhash_iremovei(hash, 1004) != 4){ in TestOtherAPI()
261 if(uhash_iremovei(hash, 1004) != 0){ in TestOtherAPI()
265 uhash_removeAll(hash); in TestOtherAPI()
266 uhash_iput(hash, 2004, (void*)one, &status); in TestOtherAPI()
267 uhash_iput(hash, 2005, (void*)two, &status); in TestOtherAPI()
268 if(uhash_count(hash) != 2){ in TestOtherAPI()
269 log_err("FAIL: uhash_count() failed. Expected: 2, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
271 if(uhash_iremove(hash, 2004) != (void*)one){ in TestOtherAPI()
274 if(uhash_iremove(hash, 2004) != NULL){ in TestOtherAPI()
277 if(uhash_count(hash) != 1){ in TestOtherAPI()
278 log_err("FAIL: uhash_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
281 uhash_close(hash); in TestOtherAPI()
290 UHashtable *hash; in hashIChars() local
292 hash = uhash_open(uhash_hashIChars, uhash_compareIChars, NULL, &status); in hashIChars()
295 u_errorName(status), hash); in hashIChars()
298 if (hash == NULL) { in hashIChars()
302 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in hashIChars()
304 _put(hash, which, 1, 0); in hashIChars()
305 _put(hash, WHICH2, 2, 1); in hashIChars()
306 _put(hash, where, 3, 0); in hashIChars()
307 if(uhash_count(hash) != 2){ in hashIChars()
308 log_err("FAIL: uhas_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in hashIChars()
310 _remove(hash, which, 2); in hashIChars()
312 uhash_close(hash); in hashIChars()
321 * This hash function is designed to collide a lot to test key equality
338 static void _put(UHashtable* hash, in _put() argument
344 uhash_puti(hash, (void*) key, value, &status); in _put()
357 static void _get(UHashtable* hash, in _get() argument
361 int32_t value = uhash_geti(hash, key); in _get()
374 static void _remove(UHashtable* hash, in _remove() argument
377 int32_t value = uhash_removei(hash, key); in _remove()