jwoodcock/c-hashtable — pull request #2 by jorendorff (2014-08-01 22:15:34+00:00)
Title: Check in some tests showing that there is some sort of bug in jwHash.c. ...

I know you're aware `add_entry` collision handling isn't finished yet. Here are two programs that illustrate the bug.

benchmark.py and benchmark.c are the same algorithm, but if you run them both, they'll give different answers.

~/dev/c-hashtable$ python3 benchmark.py < sam.txt
sam
i
...
Found 51 different words.

~/dev/c-hashtable$ make benchmark && ./benchmark < sam.txt
g++ -O3 -o benchmark benchmark.c
sam
add hash: 48
i
add hash: 14
...
Found 137 different words.

(Python's `set` object is a hash table. The code that says `if word not in seen` is basically doing `look_up(word)`. The code that says `seen.add(word)` is doing `add_entry("", "", word)`.)