Add failing unit test for BitSet

This exposes a bug where resizing of a BitSet will hang when expanding to size
1 modulo 8.
Fix infinite loop in BitSet

When a bitset needs to be resized to set the (x)th bit, it should grow
to have size (x+1). Previous code only grew to size (x), leading to an
infinite loop because the BitSet kept being too small.