@@ -35,6 +35,14 @@ public function testUnsignedBitReader($brBig, $brLittle)
3535 $ this ->assertEquals (0 , $ brLittle ->readUBits (4 ));
3636 $ this ->assertEquals (0 , $ brBig ->readUBits (2 ));
3737 $ this ->assertEquals (0 , $ brLittle ->readUBits (2 ));
38+
39+ $ brBig ->readUBits (80 );
40+ $ brLittle ->readUBits (80 );
41+
42+ $ this ->assertEquals (0xF , $ brBig ->readUBits (4 ));
43+ $ this ->assertEquals (0xF , $ brLittle ->readUBits (4 ));
44+ $ this ->assertEquals (3 , $ brBig ->readUBits (2 ));
45+ $ this ->assertEquals (3 , $ brLittle ->readUBits (2 ));
3846 }
3947
4048 /**
@@ -100,4 +108,30 @@ public function testExceptionInvalidBitCountLittleEndian($brBig, $brLittle)
100108 {
101109 $ brLittle ->readBits ('foo ' );
102110 }
111+
112+ /**
113+ * @expectedException \OutOfBoundsException
114+ * @dataProvider binaryReaders
115+ */
116+ public function testExceptionBitsOnLastBitsBigEndian ($ brBig , $ brLittle )
117+ {
118+ $ brBig ->setPosition (15 );
119+ $ brBig ->readBits (4 );
120+ $ brBig ->readBits (2 );
121+ $ brBig ->readBits (2 );
122+ $ brBig ->readBits (1 );
123+ }
124+
125+ /**
126+ * @expectedException \OutOfBoundsException
127+ * @dataProvider binaryReaders
128+ */
129+ public function testExceptionBitsOnLastBitsLittleEndian ($ brBig , $ brLittle )
130+ {
131+ $ brLittle ->setPosition (15 );
132+ $ brLittle ->readBits (4 );
133+ $ brLittle ->readBits (2 );
134+ $ brLittle ->readBits (2 );
135+ $ brLittle ->readBits (1 );
136+ }
103137}
0 commit comments