diff options
author | Bruno Haible <bruno@clisp.org> | 2000-08-19 06:20:11 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2000-08-19 06:20:11 +0000 |
commit | 501ee3e64033e900181aaebd7ae44dbcacccca9d (patch) | |
tree | 2f1dfc500f54d083dba1a0ebb13b0e418631b6d4 /tests/test.c | |
download | gperf-501ee3e64033e900181aaebd7ae44dbcacccca9d.tar.gz |
Initial revision
Diffstat (limited to 'tests/test.c')
-rw-r--r-- | tests/test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test.c b/tests/test.c new file mode 100644 index 0000000..5d78156 --- /dev/null +++ b/tests/test.c @@ -0,0 +1,26 @@ +/* + Tests the generated perfect hash function. + The -v option prints diagnostics as to whether a word is in + the set or not. Without -v the program is useful for timing. +*/ + +#include <stdio.h> + +#define MAX_LEN 80 + +int +main (argc, argv) + int argc; + char *argv[]; +{ + int verbose = argc > 1 ? 1 : 0; + char buf[MAX_LEN]; + + while (gets (buf)) + if (in_word_set (buf, strlen (buf)) && verbose) + printf ("in word set %s\n", buf); + else if (verbose) + printf ("NOT in word set %s\n", buf); + + return 0; +} |