On OS X, this test:
I think this is abusing DenseSet.h, but the bug report says it used to
I never claimed any such thing.
This did come up in a real situation where I know the size of a particular set. The set can get large enough to justify giving size advice to the implementation, but it can also be quite small, which triggered this bug. 2 is not an a priori unreasonable initial size to give to a hashtable (although I should've been scaling the size upwards to prevent excess collisions anyway).
Question: How can I test this? I was able to create a nifty
Googletest unit test:
This test works fine, so long as it passes. If the observed failure
happens, it hangs at the set.count(2) call, and the Googletest
framework apparently doesn't catch hangs. (At least, it didn't wake
up after twenty minutes.)
Unfortunately, it looks like the current Googletest framework doesn't support test timeouts or anything like them. You could probably hack it by creating a thread to sleep() for five seconds and then kill the current process, but ugh.
My take is: just add the test. If it infinite loops, then we'll know there is a problem.