lib: add testBit impl.

This pull request adds a `testBit` implementation and appropriate tests.

I'm still getting my head around how the internal state is stored, so this may not be the most efficient way.  But, it passes all the tests I've thrown at it.

Feel free to abuse, and I'm happy to make changes.