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 correct/efficient way.  But, it passes all the tests I've thrown at it.

Feel free to abuse, and I'm happy to make any changes required. 
Could we call it `testn` instead? I usually add suffix `n` when the method accept plain number.