1 #include <search.h> 2 #include <stdio.h> 3 4 static int do_test(void)5do_test (void) 6 { 7 if (hcreate (1) == 0) 8 { 9 puts ("hcreate failed"); 10 return 1; 11 } 12 ENTRY e; 13 e.key = (char *) "a"; 14 e.data = (char *) "b"; 15 if (hsearch (e, ENTER) == NULL) 16 { 17 puts ("ENTER failed"); 18 return 1; 19 } 20 ENTRY s; 21 s.key = (char *) "c"; 22 if (hsearch (s, FIND) != NULL) 23 { 24 puts ("FIND succeeded"); 25 return 1; 26 } 27 return 0; 28 } 29 30 #define TEST_FUNCTION do_test () 31 #include "../test-skeleton.c" 32