2 Tests the generated perfect hash function.
3 The -v option prints diagnostics as to whether a word is in
4 the set or not. Without -v the program is useful for timing.
10 extern const char * in_word_set (const char *, size_t);
15 main (int argc
, char *argv
[])
17 int verbose
= argc
> 1 ? 1 : 0;
20 while (fgets (buf
, MAX_LEN
, stdin
))
22 if (strlen (buf
) > 0 && buf
[strlen (buf
) - 1] == '\n')
23 buf
[strlen (buf
) - 1] = '\0';
25 if (in_word_set (buf
, strlen (buf
)))
28 printf ("in word set %s\n", buf
);
33 printf ("NOT in word set %s\n", buf
);