xref: /aosp_15_r20/external/cronet/third_party/apache-portable-runtime/src/test/testhash.c (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "testutil.h"
18 #include "apr.h"
19 #include "apr_strings.h"
20 #include "apr_general.h"
21 #include "apr_pools.h"
22 #include "apr_hash.h"
23 
24 #define MAX_LTH 256
25 #define MAX_DEPTH 11
26 
comp_string(const void * str1,const void * str2)27 static int comp_string(const void *str1, const void *str2)
28 {
29     return strcmp(str1,str2);
30 }
31 
dump_hash(apr_pool_t * p,apr_hash_t * h,char str[][MAX_LTH])32 static void dump_hash(apr_pool_t *p, apr_hash_t *h, char str[][MAX_LTH])
33 {
34     apr_hash_index_t *hi;
35     int i = 0;
36 
37     for (hi = apr_hash_first(p, h); hi; hi = apr_hash_next(hi)) {
38         const char *key = apr_hash_this_key(hi);
39         apr_ssize_t len = apr_hash_this_key_len(hi);
40         char *val = apr_hash_this_val(hi);
41 
42         str[i][0]='\0';
43         apr_snprintf(str[i], MAX_LTH, "%sKey %s (%" APR_SSIZE_T_FMT ") Value %s\n",
44                  str[i], key, len, val);
45         i++;
46     }
47     str[i][0]='\0';
48     apr_snprintf(str[i], MAX_LTH, "%s#entries %d\n", str[i], i);
49 
50     /* Sort the result strings so that they can be checked for expected results easily,
51      * without having to worry about platform quirks
52      */
53     qsort(
54         str, /* Pointer to elements */
55         i,   /* number of elements */
56         MAX_LTH, /* size of one element */
57         comp_string /* Pointer to comparison routine */
58     );
59 }
60 
sum_hash(apr_pool_t * p,apr_hash_t * h,int * pcount,int * keySum,int * valSum)61 static void sum_hash(apr_pool_t *p, apr_hash_t *h, int *pcount, int *keySum, int *valSum)
62 {
63     apr_hash_index_t *hi;
64     void *val, *key;
65     int count = 0;
66 
67     *keySum = 0;
68     *valSum = 0;
69     *pcount = 0;
70     for (hi = apr_hash_first(p, h); hi; hi = apr_hash_next(hi)) {
71         apr_hash_this(hi, (void*)&key, NULL, &val);
72         *valSum += *(int *)val;
73         *keySum += *(int *)key;
74         count++;
75     }
76     *pcount=count;
77 }
78 
hash_make(abts_case * tc,void * data)79 static void hash_make(abts_case *tc, void *data)
80 {
81     apr_hash_t *h = NULL;
82 
83     h = apr_hash_make(p);
84     ABTS_PTR_NOTNULL(tc, h);
85 }
86 
hash_set(abts_case * tc,void * data)87 static void hash_set(abts_case *tc, void *data)
88 {
89     apr_hash_t *h = NULL;
90     char *result = NULL;
91 
92     h = apr_hash_make(p);
93     ABTS_PTR_NOTNULL(tc, h);
94 
95     apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value");
96     result = apr_hash_get(h, "key", APR_HASH_KEY_STRING);
97     ABTS_STR_EQUAL(tc, "value", result);
98 }
99 
hash_reset(abts_case * tc,void * data)100 static void hash_reset(abts_case *tc, void *data)
101 {
102     apr_hash_t *h = NULL;
103     char *result = NULL;
104 
105     h = apr_hash_make(p);
106     ABTS_PTR_NOTNULL(tc, h);
107 
108     apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value");
109     result = apr_hash_get(h, "key", APR_HASH_KEY_STRING);
110     ABTS_STR_EQUAL(tc, "value", result);
111 
112     apr_hash_set(h, "key", APR_HASH_KEY_STRING, "new");
113     result = apr_hash_get(h, "key", APR_HASH_KEY_STRING);
114     ABTS_STR_EQUAL(tc, "new", result);
115 }
116 
same_value(abts_case * tc,void * data)117 static void same_value(abts_case *tc, void *data)
118 {
119     apr_hash_t *h = NULL;
120     char *result = NULL;
121 
122     h = apr_hash_make(p);
123     ABTS_PTR_NOTNULL(tc, h);
124 
125     apr_hash_set(h, "same1", APR_HASH_KEY_STRING, "same");
126     result = apr_hash_get(h, "same1", APR_HASH_KEY_STRING);
127     ABTS_STR_EQUAL(tc, "same", result);
128 
129     apr_hash_set(h, "same2", APR_HASH_KEY_STRING, "same");
130     result = apr_hash_get(h, "same2", APR_HASH_KEY_STRING);
131     ABTS_STR_EQUAL(tc, "same", result);
132 }
133 
hash_custom(const char * key,apr_ssize_t * klen)134 static unsigned int hash_custom( const char *key, apr_ssize_t *klen)
135 {
136     unsigned int hash = 0;
137     while( *klen ) {
138         (*klen) --;
139         hash = hash * 33 + key[ *klen ];
140     }
141     return hash;
142 }
143 
same_value_custom(abts_case * tc,void * data)144 static void same_value_custom(abts_case *tc, void *data)
145 {
146     apr_hash_t *h = NULL;
147     char *result = NULL;
148 
149     h = apr_hash_make_custom(p, hash_custom);
150     ABTS_PTR_NOTNULL(tc, h);
151 
152     apr_hash_set(h, "same1", 5, "same");
153     result = apr_hash_get(h, "same1", 5);
154     ABTS_STR_EQUAL(tc, "same", result);
155 
156     apr_hash_set(h, "same2", 5, "same");
157     result = apr_hash_get(h, "same2", 5);
158     ABTS_STR_EQUAL(tc, "same", result);
159 }
160 
key_space(abts_case * tc,void * data)161 static void key_space(abts_case *tc, void *data)
162 {
163     apr_hash_t *h = NULL;
164     char *result = NULL;
165 
166     h = apr_hash_make(p);
167     ABTS_PTR_NOTNULL(tc, h);
168 
169     apr_hash_set(h, "key with space", APR_HASH_KEY_STRING, "value");
170     result = apr_hash_get(h, "key with space", APR_HASH_KEY_STRING);
171     ABTS_STR_EQUAL(tc, "value", result);
172 }
173 
hash_clear(abts_case * tc,void * data)174 static void hash_clear(abts_case *tc, void *data)
175 {
176     apr_hash_t *h;
177     int i, *e;
178 
179     h = apr_hash_make(p);
180     ABTS_PTR_NOTNULL(tc, h);
181 
182     for (i = 1; i <= 10; i++) {
183         e = apr_palloc(p, sizeof(int));
184         *e = i;
185         apr_hash_set(h, e, sizeof(*e), e);
186     }
187     apr_hash_clear(h);
188     i = apr_hash_count(h);
189     ABTS_INT_EQUAL(tc, 0, i);
190 }
191 
192 /* This is kind of a hack, but I am just keeping an existing test.  This is
193  * really testing apr_hash_first, apr_hash_next, and apr_hash_this which
194  * should be tested in three separate tests, but this will do for now.
195  */
hash_traverse(abts_case * tc,void * data)196 static void hash_traverse(abts_case *tc, void *data)
197 {
198     apr_hash_t *h;
199     char StrArray[MAX_DEPTH][MAX_LTH];
200 
201     h = apr_hash_make(p);
202     ABTS_PTR_NOTNULL(tc, h);
203 
204     apr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "should not see this");
205     apr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3");
206     apr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3");
207     apr_hash_set(h, "FOO1", APR_HASH_KEY_STRING, "bar1");
208     apr_hash_set(h, "FOO2", APR_HASH_KEY_STRING, "bar2");
209     apr_hash_set(h, "FOO4", APR_HASH_KEY_STRING, "bar4");
210     apr_hash_set(h, "SAME1", APR_HASH_KEY_STRING, "same");
211     apr_hash_set(h, "SAME2", APR_HASH_KEY_STRING, "same");
212     apr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "Overwrite key");
213 
214     dump_hash(p, h, StrArray);
215 
216     ABTS_STR_EQUAL(tc, "Key FOO1 (4) Value bar1\n", StrArray[0]);
217     ABTS_STR_EQUAL(tc, "Key FOO2 (4) Value bar2\n", StrArray[1]);
218     ABTS_STR_EQUAL(tc, "Key FOO3 (4) Value bar3\n", StrArray[2]);
219     ABTS_STR_EQUAL(tc, "Key FOO4 (4) Value bar4\n", StrArray[3]);
220     ABTS_STR_EQUAL(tc, "Key OVERWRITE (9) Value Overwrite key\n", StrArray[4]);
221     ABTS_STR_EQUAL(tc, "Key SAME1 (5) Value same\n", StrArray[5]);
222     ABTS_STR_EQUAL(tc, "Key SAME2 (5) Value same\n", StrArray[6]);
223     ABTS_STR_EQUAL(tc, "#entries 7\n", StrArray[7]);
224 }
225 
226 /* This is kind of a hack, but I am just keeping an existing test.  This is
227  * really testing apr_hash_first, apr_hash_next, and apr_hash_this which
228  * should be tested in three separate tests, but this will do for now.
229  */
summation_test(abts_case * tc,void * data)230 static void summation_test(abts_case *tc, void *data)
231 {
232     apr_hash_t *h;
233     int sumKeys, sumVal, trySumKey, trySumVal;
234     int i, j, *val, *key;
235 
236     h =apr_hash_make(p);
237     ABTS_PTR_NOTNULL(tc, h);
238 
239     sumKeys = 0;
240     sumVal = 0;
241     trySumKey = 0;
242     trySumVal = 0;
243 
244     for (i = 0; i < 100; i++) {
245         j = i * 10 + 1;
246         sumKeys += j;
247         sumVal += i;
248         key = apr_palloc(p, sizeof(int));
249         *key = j;
250         val = apr_palloc(p, sizeof(int));
251         *val = i;
252         apr_hash_set(h, key, sizeof(int), val);
253     }
254 
255     sum_hash(p, h, &i, &trySumKey, &trySumVal);
256     ABTS_INT_EQUAL(tc, 100, i);
257     ABTS_INT_EQUAL(tc, sumVal, trySumVal);
258     ABTS_INT_EQUAL(tc, sumKeys, trySumKey);
259 }
260 
delete_key(abts_case * tc,void * data)261 static void delete_key(abts_case *tc, void *data)
262 {
263     apr_hash_t *h = NULL;
264     char *result = NULL;
265 
266     h = apr_hash_make(p);
267     ABTS_PTR_NOTNULL(tc, h);
268 
269     apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value");
270     apr_hash_set(h, "key2", APR_HASH_KEY_STRING, "value2");
271 
272     result = apr_hash_get(h, "key", APR_HASH_KEY_STRING);
273     ABTS_STR_EQUAL(tc, "value", result);
274 
275     result = apr_hash_get(h, "key2", APR_HASH_KEY_STRING);
276     ABTS_STR_EQUAL(tc, "value2", result);
277 
278     apr_hash_set(h, "key", APR_HASH_KEY_STRING, NULL);
279 
280     result = apr_hash_get(h, "key", APR_HASH_KEY_STRING);
281     ABTS_PTR_EQUAL(tc, NULL, result);
282 
283     result = apr_hash_get(h, "key2", APR_HASH_KEY_STRING);
284     ABTS_STR_EQUAL(tc, "value2", result);
285 }
286 
hash_count_0(abts_case * tc,void * data)287 static void hash_count_0(abts_case *tc, void *data)
288 {
289     apr_hash_t *h = NULL;
290     int count;
291 
292     h = apr_hash_make(p);
293     ABTS_PTR_NOTNULL(tc, h);
294 
295     count = apr_hash_count(h);
296     ABTS_INT_EQUAL(tc, 0, count);
297 }
298 
hash_count_1(abts_case * tc,void * data)299 static void hash_count_1(abts_case *tc, void *data)
300 {
301     apr_hash_t *h = NULL;
302     int count;
303 
304     h = apr_hash_make(p);
305     ABTS_PTR_NOTNULL(tc, h);
306 
307     apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value");
308 
309     count = apr_hash_count(h);
310     ABTS_INT_EQUAL(tc, 1, count);
311 }
312 
hash_count_5(abts_case * tc,void * data)313 static void hash_count_5(abts_case *tc, void *data)
314 {
315     apr_hash_t *h = NULL;
316     int count;
317 
318     h = apr_hash_make(p);
319     ABTS_PTR_NOTNULL(tc, h);
320 
321     apr_hash_set(h, "key1", APR_HASH_KEY_STRING, "value1");
322     apr_hash_set(h, "key2", APR_HASH_KEY_STRING, "value2");
323     apr_hash_set(h, "key3", APR_HASH_KEY_STRING, "value3");
324     apr_hash_set(h, "key4", APR_HASH_KEY_STRING, "value4");
325     apr_hash_set(h, "key5", APR_HASH_KEY_STRING, "value5");
326 
327     count = apr_hash_count(h);
328     ABTS_INT_EQUAL(tc, 5, count);
329 }
330 
overlay_empty(abts_case * tc,void * data)331 static void overlay_empty(abts_case *tc, void *data)
332 {
333     apr_hash_t *base = NULL;
334     apr_hash_t *overlay = NULL;
335     apr_hash_t *result = NULL;
336     int count;
337     char StrArray[MAX_DEPTH][MAX_LTH];
338 
339     base = apr_hash_make(p);
340     overlay = apr_hash_make(p);
341     ABTS_PTR_NOTNULL(tc, base);
342     ABTS_PTR_NOTNULL(tc, overlay);
343 
344     apr_hash_set(base, "key1", APR_HASH_KEY_STRING, "value1");
345     apr_hash_set(base, "key2", APR_HASH_KEY_STRING, "value2");
346     apr_hash_set(base, "key3", APR_HASH_KEY_STRING, "value3");
347     apr_hash_set(base, "key4", APR_HASH_KEY_STRING, "value4");
348     apr_hash_set(base, "key5", APR_HASH_KEY_STRING, "value5");
349 
350     result = apr_hash_overlay(p, overlay, base);
351 
352     count = apr_hash_count(result);
353     ABTS_INT_EQUAL(tc, 5, count);
354 
355     dump_hash(p, result, StrArray);
356 
357     ABTS_STR_EQUAL(tc, "Key key1 (4) Value value1\n", StrArray[0]);
358     ABTS_STR_EQUAL(tc, "Key key2 (4) Value value2\n", StrArray[1]);
359     ABTS_STR_EQUAL(tc, "Key key3 (4) Value value3\n", StrArray[2]);
360     ABTS_STR_EQUAL(tc, "Key key4 (4) Value value4\n", StrArray[3]);
361     ABTS_STR_EQUAL(tc, "Key key5 (4) Value value5\n", StrArray[4]);
362     ABTS_STR_EQUAL(tc, "#entries 5\n", StrArray[5]);
363 }
364 
overlay_2unique(abts_case * tc,void * data)365 static void overlay_2unique(abts_case *tc, void *data)
366 {
367     apr_hash_t *base = NULL;
368     apr_hash_t *overlay = NULL;
369     apr_hash_t *result = NULL;
370     int count;
371     char StrArray[MAX_DEPTH][MAX_LTH];
372 
373     base = apr_hash_make(p);
374     overlay = apr_hash_make(p);
375     ABTS_PTR_NOTNULL(tc, base);
376     ABTS_PTR_NOTNULL(tc, overlay);
377 
378     apr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1");
379     apr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2");
380     apr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3");
381     apr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4");
382     apr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5");
383 
384     apr_hash_set(overlay, "overlay1", APR_HASH_KEY_STRING, "value1");
385     apr_hash_set(overlay, "overlay2", APR_HASH_KEY_STRING, "value2");
386     apr_hash_set(overlay, "overlay3", APR_HASH_KEY_STRING, "value3");
387     apr_hash_set(overlay, "overlay4", APR_HASH_KEY_STRING, "value4");
388     apr_hash_set(overlay, "overlay5", APR_HASH_KEY_STRING, "value5");
389 
390     result = apr_hash_overlay(p, overlay, base);
391 
392     count = apr_hash_count(result);
393     ABTS_INT_EQUAL(tc, 10, count);
394 
395     dump_hash(p, result, StrArray);
396 
397     ABTS_STR_EQUAL(tc, "Key base1 (5) Value value1\n", StrArray[0]);
398     ABTS_STR_EQUAL(tc, "Key base2 (5) Value value2\n", StrArray[1]);
399     ABTS_STR_EQUAL(tc, "Key base3 (5) Value value3\n", StrArray[2]);
400     ABTS_STR_EQUAL(tc, "Key base4 (5) Value value4\n", StrArray[3]);
401     ABTS_STR_EQUAL(tc, "Key base5 (5) Value value5\n", StrArray[4]);
402     ABTS_STR_EQUAL(tc, "Key overlay1 (8) Value value1\n", StrArray[5]);
403     ABTS_STR_EQUAL(tc, "Key overlay2 (8) Value value2\n", StrArray[6]);
404     ABTS_STR_EQUAL(tc, "Key overlay3 (8) Value value3\n", StrArray[7]);
405     ABTS_STR_EQUAL(tc, "Key overlay4 (8) Value value4\n", StrArray[8]);
406     ABTS_STR_EQUAL(tc, "Key overlay5 (8) Value value5\n", StrArray[9]);
407     ABTS_STR_EQUAL(tc, "#entries 10\n", StrArray[10]);
408 }
409 
overlay_same(abts_case * tc,void * data)410 static void overlay_same(abts_case *tc, void *data)
411 {
412     apr_hash_t *base = NULL;
413     apr_hash_t *result = NULL;
414     int count;
415     char StrArray[MAX_DEPTH][MAX_LTH];
416 
417     base = apr_hash_make(p);
418     ABTS_PTR_NOTNULL(tc, base);
419 
420     apr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1");
421     apr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2");
422     apr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3");
423     apr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4");
424     apr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5");
425 
426     result = apr_hash_overlay(p, base, base);
427 
428     count = apr_hash_count(result);
429     ABTS_INT_EQUAL(tc, 5, count);
430 
431     dump_hash(p, result, StrArray);
432 
433     ABTS_STR_EQUAL(tc, "Key base1 (5) Value value1\n", StrArray[0]);
434     ABTS_STR_EQUAL(tc, "Key base2 (5) Value value2\n", StrArray[1]);
435     ABTS_STR_EQUAL(tc, "Key base3 (5) Value value3\n", StrArray[2]);
436     ABTS_STR_EQUAL(tc, "Key base4 (5) Value value4\n", StrArray[3]);
437     ABTS_STR_EQUAL(tc, "Key base5 (5) Value value5\n", StrArray[4]);
438     ABTS_STR_EQUAL(tc, "#entries 5\n", StrArray[5]);
439 }
440 
overlay_fetch(abts_case * tc,void * data)441 static void overlay_fetch(abts_case *tc, void *data)
442 {
443     apr_hash_t *base = NULL;
444     apr_hash_t *overlay = NULL;
445     apr_hash_t *result = NULL;
446     int count;
447 
448     base = apr_hash_make(p);
449     overlay = apr_hash_make(p);
450     ABTS_PTR_NOTNULL(tc, base);
451     ABTS_PTR_NOTNULL(tc, overlay);
452 
453     apr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1");
454     apr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2");
455     apr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3");
456     apr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4");
457     apr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5");
458 
459     apr_hash_set(overlay, "overlay1", APR_HASH_KEY_STRING, "value1");
460     apr_hash_set(overlay, "overlay2", APR_HASH_KEY_STRING, "value2");
461     apr_hash_set(overlay, "overlay3", APR_HASH_KEY_STRING, "value3");
462     apr_hash_set(overlay, "overlay4", APR_HASH_KEY_STRING, "value4");
463     apr_hash_set(overlay, "overlay5", APR_HASH_KEY_STRING, "value5");
464 
465     result = apr_hash_overlay(p, overlay, base);
466 
467     count = apr_hash_count(result);
468     ABTS_INT_EQUAL(tc, 10, count);
469 
470     ABTS_STR_EQUAL(tc, "value1",
471                        apr_hash_get(result, "base1", APR_HASH_KEY_STRING));
472     ABTS_STR_EQUAL(tc, "value2",
473                        apr_hash_get(result, "base2", APR_HASH_KEY_STRING));
474     ABTS_STR_EQUAL(tc, "value3",
475                        apr_hash_get(result, "base3", APR_HASH_KEY_STRING));
476     ABTS_STR_EQUAL(tc, "value4",
477                        apr_hash_get(result, "base4", APR_HASH_KEY_STRING));
478     ABTS_STR_EQUAL(tc, "value5",
479                        apr_hash_get(result, "base5", APR_HASH_KEY_STRING));
480     ABTS_STR_EQUAL(tc, "value1",
481                        apr_hash_get(result, "overlay1", APR_HASH_KEY_STRING));
482     ABTS_STR_EQUAL(tc, "value2",
483                        apr_hash_get(result, "overlay2", APR_HASH_KEY_STRING));
484     ABTS_STR_EQUAL(tc, "value3",
485                        apr_hash_get(result, "overlay3", APR_HASH_KEY_STRING));
486     ABTS_STR_EQUAL(tc, "value4",
487                        apr_hash_get(result, "overlay4", APR_HASH_KEY_STRING));
488     ABTS_STR_EQUAL(tc, "value5",
489                        apr_hash_get(result, "overlay5", APR_HASH_KEY_STRING));
490 
491     ABTS_STR_EQUAL(tc, "value1",
492                        apr_hash_get(base, "base1", APR_HASH_KEY_STRING));
493     ABTS_STR_EQUAL(tc, "value2",
494                        apr_hash_get(base, "base2", APR_HASH_KEY_STRING));
495     ABTS_STR_EQUAL(tc, "value3",
496                        apr_hash_get(base, "base3", APR_HASH_KEY_STRING));
497     ABTS_STR_EQUAL(tc, "value4",
498                        apr_hash_get(base, "base4", APR_HASH_KEY_STRING));
499     ABTS_STR_EQUAL(tc, "value5",
500                        apr_hash_get(base, "base5", APR_HASH_KEY_STRING));
501 
502     ABTS_STR_EQUAL(tc, "value1",
503                        apr_hash_get(overlay, "overlay1", APR_HASH_KEY_STRING));
504     ABTS_STR_EQUAL(tc, "value2",
505                        apr_hash_get(overlay, "overlay2", APR_HASH_KEY_STRING));
506     ABTS_STR_EQUAL(tc, "value3",
507                        apr_hash_get(overlay, "overlay3", APR_HASH_KEY_STRING));
508     ABTS_STR_EQUAL(tc, "value4",
509                        apr_hash_get(overlay, "overlay4", APR_HASH_KEY_STRING));
510     ABTS_STR_EQUAL(tc, "value5",
511                        apr_hash_get(overlay, "overlay5", APR_HASH_KEY_STRING));
512 }
513 
testhash(abts_suite * suite)514 abts_suite *testhash(abts_suite *suite)
515 {
516     suite = ADD_SUITE(suite)
517 
518     abts_run_test(suite, hash_make, NULL);
519     abts_run_test(suite, hash_set, NULL);
520     abts_run_test(suite, hash_reset, NULL);
521     abts_run_test(suite, same_value, NULL);
522     abts_run_test(suite, same_value_custom, NULL);
523     abts_run_test(suite, key_space, NULL);
524     abts_run_test(suite, delete_key, NULL);
525 
526     abts_run_test(suite, hash_count_0, NULL);
527     abts_run_test(suite, hash_count_1, NULL);
528     abts_run_test(suite, hash_count_5, NULL);
529 
530     abts_run_test(suite, hash_clear, NULL);
531     abts_run_test(suite, hash_traverse, NULL);
532     abts_run_test(suite, summation_test, NULL);
533 
534     abts_run_test(suite, overlay_empty, NULL);
535     abts_run_test(suite, overlay_2unique, NULL);
536     abts_run_test(suite, overlay_same, NULL);
537     abts_run_test(suite, overlay_fetch, NULL);
538 
539     return suite;
540 }
541 
542