Lines Matching refs:hash
34 static void _put(UHashtable* hash,
39 static void _get(UHashtable* hash,
43 static void _remove(UHashtable* hash,
109 UHashtable *hash; in TestBasic() local
111 hash = uhash_open(hashChars, isEqualChars, NULL, &status); in TestBasic()
114 u_errorName(status), hash); in TestBasic()
117 if (hash == NULL) { in TestBasic()
121 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in TestBasic()
123 _put(hash, one, 1, 0); in TestBasic()
124 _put(hash, omega, 24, 0); in TestBasic()
125 _put(hash, two, 2, 0); in TestBasic()
126 _put(hash, three, 3, 0); in TestBasic()
127 _put(hash, one, -1, 1); in TestBasic()
128 _put(hash, two, -2, 2); in TestBasic()
129 _put(hash, omega, 48, 24); in TestBasic()
130 _put(hash, one, 100, -1); in TestBasic()
131 _get(hash, three, 3); in TestBasic()
132 _remove(hash, two, -2); in TestBasic()
133 _get(hash, two, 0); in TestBasic()
134 _get(hash, one, 100); in TestBasic()
135 _put(hash, two, 200, 0); in TestBasic()
136 _get(hash, omega, 48); in TestBasic()
137 _get(hash, two, 200); in TestBasic()
140 _put(hash, two, 0, 200); in TestBasic()
155 uhash_close(hash); in TestBasic()
160 UHashtable *hash = uhash_open(hashChars, isEqualChars, NULL, &status); in TestAllowZero() local
163 u_errorName(status), hash); in TestAllowZero()
166 if (hash == NULL) { in TestAllowZero()
170 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in TestAllowZero()
172 int32_t oldValue = uhash_putiAllowZero(hash, (char *)"one", 1, &status); in TestAllowZero()
174 if (U_FAILURE(status) || oldValue != 0 || !uhash_containsKey(hash, "one") || in TestAllowZero()
175 uhash_geti(hash, "one") != 1 || in TestAllowZero()
176 uhash_getiAndFound(hash, "one", &found) != 1 || !found) { in TestAllowZero()
179 oldValue = uhash_putiAllowZero(hash, (char *)"zero", 0, &status); in TestAllowZero()
181 if (U_FAILURE(status) || oldValue != 0 || !uhash_containsKey(hash, "zero") || in TestAllowZero()
182 uhash_geti(hash, "zero") != 0 || in TestAllowZero()
183 uhash_getiAndFound(hash, "zero", &found) != 0 || !found) { in TestAllowZero()
187 oldValue = uhash_putiAllowZero(hash, (char *)"one", 0, &status); in TestAllowZero()
189 if (U_FAILURE(status) || oldValue != 1 || !uhash_containsKey(hash, "one") || in TestAllowZero()
190 uhash_geti(hash, "one") != 0 || in TestAllowZero()
191 uhash_getiAndFound(hash, "one", &found) != 0 || !found) { in TestAllowZero()
195 oldValue = uhash_puti(hash, (char *)"zero", 0, &status); in TestAllowZero()
197 if (U_FAILURE(status) || oldValue != 0 || uhash_containsKey(hash, "zero") || in TestAllowZero()
198 uhash_geti(hash, "zero") != 0 || in TestAllowZero()
199 uhash_getiAndFound(hash, "zero", &found) != 0 || found) { in TestAllowZero()
203 uhash_close(hash); in TestAllowZero()
209 UHashtable *hash; in TestOtherAPI() local
221 hash = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status); in TestOtherAPI()
224 u_errorName(status), hash); in TestOtherAPI()
227 if (hash == NULL) { in TestOtherAPI()
231 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in TestOtherAPI()
233 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
234 if(uhash_count(hash) != 1){ in TestOtherAPI()
235 log_err("FAIL: uhas_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
237 if(uhash_find(hash, (void*)two) != NULL){ in TestOtherAPI()
240 uhash_puti(hash, (void*)two, 2, &status); in TestOtherAPI()
241 uhash_puti(hash, (void*)three, 3, &status); in TestOtherAPI()
242 uhash_puti(hash, (void*)four, 4, &status); in TestOtherAPI()
243 uhash_puti(hash, (void*)five, 5, &status); in TestOtherAPI()
245 if(uhash_count(hash) != 5){ in TestOtherAPI()
246 log_err("FAIL: uhas_count() failed. Expected: 5, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
249 if(uhash_geti(hash, (void*)two2) != 2){ in TestOtherAPI()
253 if(uhash_find(hash, (void*)two2) == NULL){ in TestOtherAPI()
257 if(uhash_removei(hash, (void*)five2) != 5){ in TestOtherAPI()
260 if(uhash_count(hash) != 4){ in TestOtherAPI()
261 log_err("FAIL: uhas_count() failed. Expected: 4, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
264 uhash_put(hash, (void*)one, NULL, &status); in TestOtherAPI()
265 if(uhash_count(hash) != 3){ in TestOtherAPI()
269 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
270 if(uhash_count(hash) != 3){ in TestOtherAPI()
275 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
276 if(uhash_count(hash) != 4){ in TestOtherAPI()
287 uhash_removeAll(hash); in TestOtherAPI()
288 if(uhash_count(hash) != 0){ in TestOtherAPI()
289 log_err("FAIL: uhas_count() failed. Expected: 0, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
292 uhash_setKeyComparator(hash, uhash_compareLong); in TestOtherAPI()
293 uhash_setKeyHasher(hash, uhash_hashLong); in TestOtherAPI()
294 uhash_iputi(hash, 1001, 1, &status); in TestOtherAPI()
295 uhash_iputi(hash, 1002, 2, &status); in TestOtherAPI()
296 uhash_iputi(hash, 1003, 3, &status); in TestOtherAPI()
304 uhash_setResizePolicy(hash, U_GROW_AND_SHRINK); in TestOtherAPI()
305 uhash_iputi(hash, 1004, 4, &status); in TestOtherAPI()
306 uhash_iputi(hash, 1005, 5, &status); in TestOtherAPI()
307 uhash_iputi(hash, 1006, 6, &status); in TestOtherAPI()
308 if(uhash_count(hash) != 6){ in TestOtherAPI()
309 log_err("FAIL: uhash_count() failed. Expected: 6, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
311 if(uhash_iremovei(hash, 1004) != 4){ in TestOtherAPI()
314 if(uhash_iremovei(hash, 1004) != 0){ in TestOtherAPI()
318 uhash_removeAll(hash); in TestOtherAPI()
319 uhash_iput(hash, 2004, (void*)one, &status); in TestOtherAPI()
320 uhash_iput(hash, 2005, (void*)two, &status); in TestOtherAPI()
321 if(uhash_count(hash) != 2){ in TestOtherAPI()
322 log_err("FAIL: uhash_count() failed. Expected: 2, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
324 if(uhash_iremove(hash, 2004) != (void*)one){ in TestOtherAPI()
327 if(uhash_iremove(hash, 2004) != NULL){ in TestOtherAPI()
330 if(uhash_count(hash) != 1){ in TestOtherAPI()
331 log_err("FAIL: uhash_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
334 uhash_close(hash); in TestOtherAPI()
343 UHashtable *hash; in hashIChars() local
345 hash = uhash_open(uhash_hashIChars, uhash_compareIChars, NULL, &status); in hashIChars()
348 u_errorName(status), hash); in hashIChars()
351 if (hash == NULL) { in hashIChars()
355 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in hashIChars()
357 _put(hash, which, 1, 0); in hashIChars()
358 _put(hash, WHICH2, 2, 1); in hashIChars()
359 _put(hash, where, 3, 0); in hashIChars()
360 if(uhash_count(hash) != 2){ in hashIChars()
361 log_err("FAIL: uhas_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in hashIChars()
363 _remove(hash, which, 2); in hashIChars()
365 uhash_close(hash); in hashIChars()
391 static void _put(UHashtable* hash, in _put() argument
397 uhash_puti(hash, (void*) key, value, &status); in _put()
408 int32_t newValue = uhash_geti(hash, key); in _put()
414 UBool contained = uhash_containsKey(hash, key); in _put()
430 static void _get(UHashtable* hash, in _get() argument
433 int32_t value = uhash_geti(hash, key); in _get()
443 static void _remove(UHashtable* hash, in _remove() argument
446 int32_t value = uhash_removei(hash, key); in _remove()
454 if (uhash_containsKey(hash, key)) { in _remove()