9 e = hsearch((ENTRY){.key = k, .data = (void*)v}, ENTER); \
10 if (!e || strcmp(e->key, k) != 0) \
11 t_error("hsearch ENTER %s %d failed\n", k, v); \
14 #define get(k) hsearch((ENTRY){.key = k, .data = 0}, FIND)
16 #define getdata(e) ((intptr_t)(e)->data)
22 if (hcreate(-1) || errno != ENOMEM)
23 t_error("hcreate((size_t)-1) should fail with ENOMEM got %s\n", strerror(errno));
25 t_error("hcreate(13) failed\n");
37 t_error("hsearch FIND a failed\n");
39 t_error("hsearch FIND c should fail\n");
41 if (e && getdata(e) != 7)
42 t_error("hsearch ENTER g 10 returned data %d, wanted 7\n", getdata(e));
44 if (e && getdata(e) != 7)
45 t_error("hsearch ENTER g 10 returned data %d, wanted 7\n", getdata(e));
47 if (e && getdata(e) != 10)
48 t_error("hsearch ENTER j 10 returned data %d, wanted 10\n", getdata(e));