Add test for streamWriteBits and streamWriteBit
Fix streamReadBits code and add tests for streamReadBits