Lines Matching refs:hash
30 static void _put(UHashtable* hash,
35 static void _get(UHashtable* hash,
39 static void _remove(UHashtable* hash,
104 UHashtable *hash; in TestBasic() local
106 hash = uhash_open(hashChars, isEqualChars, NULL, &status); in TestBasic()
109 u_errorName(status), hash); in TestBasic()
112 if (hash == NULL) { in TestBasic()
116 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in TestBasic()
118 _put(hash, one, 1, 0); in TestBasic()
119 _put(hash, omega, 24, 0); in TestBasic()
120 _put(hash, two, 2, 0); in TestBasic()
121 _put(hash, three, 3, 0); in TestBasic()
122 _put(hash, one, -1, 1); in TestBasic()
123 _put(hash, two, -2, 2); in TestBasic()
124 _put(hash, omega, 48, 24); in TestBasic()
125 _put(hash, one, 100, -1); in TestBasic()
126 _get(hash, three, 3); in TestBasic()
127 _remove(hash, two, -2); in TestBasic()
128 _get(hash, two, 0); in TestBasic()
129 _get(hash, one, 100); in TestBasic()
130 _put(hash, two, 200, 0); in TestBasic()
131 _get(hash, omega, 48); in TestBasic()
132 _get(hash, two, 200); in TestBasic()
147 uhash_close(hash); in TestBasic()
154 UHashtable *hash; in TestOtherAPI() local
166 hash = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status); in TestOtherAPI()
169 u_errorName(status), hash); in TestOtherAPI()
172 if (hash == NULL) { in TestOtherAPI()
176 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in TestOtherAPI()
178 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
179 if(uhash_count(hash) != 1){ in TestOtherAPI()
180 log_err("FAIL: uhas_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
182 if(uhash_find(hash, (void*)two) != NULL){ in TestOtherAPI()
185 uhash_puti(hash, (void*)two, 2, &status); in TestOtherAPI()
186 uhash_puti(hash, (void*)three, 3, &status); in TestOtherAPI()
187 uhash_puti(hash, (void*)four, 4, &status); in TestOtherAPI()
188 uhash_puti(hash, (void*)five, 5, &status); in TestOtherAPI()
190 if(uhash_count(hash) != 5){ in TestOtherAPI()
191 log_err("FAIL: uhas_count() failed. Expected: 5, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
194 if(uhash_geti(hash, (void*)two2) != 2){ in TestOtherAPI()
198 if(uhash_find(hash, (void*)two2) == NULL){ in TestOtherAPI()
202 if(uhash_removei(hash, (void*)five2) != 5){ in TestOtherAPI()
205 if(uhash_count(hash) != 4){ in TestOtherAPI()
206 log_err("FAIL: uhas_count() failed. Expected: 4, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
209 uhash_put(hash, (void*)one, NULL, &status); in TestOtherAPI()
210 if(uhash_count(hash) != 3){ in TestOtherAPI()
214 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
215 if(uhash_count(hash) != 3){ in TestOtherAPI()
220 uhash_puti(hash, (void*)one, 1, &status); in TestOtherAPI()
221 if(uhash_count(hash) != 4){ in TestOtherAPI()
232 uhash_removeAll(hash); in TestOtherAPI()
233 if(uhash_count(hash) != 0){ in TestOtherAPI()
234 log_err("FAIL: uhas_count() failed. Expected: 0, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
237 uhash_setKeyComparator(hash, uhash_compareLong); in TestOtherAPI()
238 uhash_setKeyHasher(hash, uhash_hashLong); in TestOtherAPI()
239 uhash_iputi(hash, 1001, 1, &status); in TestOtherAPI()
240 uhash_iputi(hash, 1002, 2, &status); in TestOtherAPI()
241 uhash_iputi(hash, 1003, 3, &status); in TestOtherAPI()
249 uhash_setResizePolicy(hash, U_GROW_AND_SHRINK); in TestOtherAPI()
250 uhash_iputi(hash, 1004, 4, &status); in TestOtherAPI()
251 uhash_iputi(hash, 1005, 5, &status); in TestOtherAPI()
252 uhash_iputi(hash, 1006, 6, &status); in TestOtherAPI()
253 if(uhash_count(hash) != 6){ in TestOtherAPI()
254 log_err("FAIL: uhash_count() failed. Expected: 6, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
256 if(uhash_iremovei(hash, 1004) != 4){ in TestOtherAPI()
259 if(uhash_iremovei(hash, 1004) != 0){ in TestOtherAPI()
263 uhash_removeAll(hash); in TestOtherAPI()
264 uhash_iput(hash, 2004, (void*)one, &status); in TestOtherAPI()
265 uhash_iput(hash, 2005, (void*)two, &status); in TestOtherAPI()
266 if(uhash_count(hash) != 2){ in TestOtherAPI()
267 log_err("FAIL: uhash_count() failed. Expected: 2, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
269 if(uhash_iremove(hash, 2004) != (void*)one){ in TestOtherAPI()
272 if(uhash_iremove(hash, 2004) != NULL){ in TestOtherAPI()
275 if(uhash_count(hash) != 1){ in TestOtherAPI()
276 log_err("FAIL: uhash_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in TestOtherAPI()
279 uhash_close(hash); in TestOtherAPI()
288 UHashtable *hash; in hashIChars() local
290 hash = uhash_open(uhash_hashIChars, uhash_compareIChars, NULL, &status); in hashIChars()
293 u_errorName(status), hash); in hashIChars()
296 if (hash == NULL) { in hashIChars()
300 log_verbose("Ok: uhash_open returned 0x%08X\n", hash); in hashIChars()
302 _put(hash, which, 1, 0); in hashIChars()
303 _put(hash, WHICH2, 2, 1); in hashIChars()
304 _put(hash, where, 3, 0); in hashIChars()
305 if(uhash_count(hash) != 2){ in hashIChars()
306 log_err("FAIL: uhas_count() failed. Expected: 1, Got: %d\n", uhash_count(hash)); in hashIChars()
308 _remove(hash, which, 2); in hashIChars()
310 uhash_close(hash); in hashIChars()
336 static void _put(UHashtable* hash, in _put() argument
342 uhash_puti(hash, (void*) key, value, &status); in _put()
355 static void _get(UHashtable* hash, in _get() argument
359 int32_t value = uhash_geti(hash, key); in _get()
372 static void _remove(UHashtable* hash, in _remove() argument
375 int32_t value = uhash_removei(hash, key); in _remove()