decode(BYTE1S2,new byte[] { 9 }, 7, 0);
decode(BYTE1S2,new byte[] { 10 }, 8, 0);
decode(BYTE1S2,new byte[] { 11 }, -3, 0);
}
public void testCardinality() throws Exception {
BHSDCodec byte1 = Codec.BYTE1;
assertEquals(256,byte1.cardinality());
assertEquals(0,byte1.smallest());
assertEquals(255,byte1.largest());
assertFalse(byte1.encodes(-257));
assertFalse(byte1.encodes(-256));
assertFalse(byte1.encodes(-255));
assertFalse(byte1.encodes(-129));
assertFalse(byte1.encodes(-128));
assertFalse(byte1.encodes(-127));
assertFalse(byte1.encodes(-1));
assertTrue(byte1.encodes(0));
assertTrue(byte1.encodes(1));
assertTrue(byte1.encodes(255));
assertFalse(byte1.encodes(256));
BHSDCodec byte1s = new BHSDCodec(1,256,1);
assertEquals(256,byte1s.cardinality());
assertEquals(-128,byte1s.smallest());
assertEquals(127,byte1s.largest());
assertFalse(byte1s.encodes(-257));
assertFalse(byte1s.encodes(-256));
assertFalse(byte1s.encodes(-255));
assertFalse(byte1s.encodes(-129));
assertTrue(byte1s.encodes(-128));
assertTrue(byte1s.encodes(-127));
assertTrue(byte1s.encodes(-1));
assertTrue(byte1s.encodes(0));
assertTrue(byte1s.encodes(1));
assertTrue(byte1s.encodes(127));
assertFalse(byte1s.encodes(128));
assertFalse(byte1s.encodes(129));
assertFalse(byte1s.encodes(255));
assertFalse(byte1s.encodes(256));
BHSDCodec byte2s = new BHSDCodec(1,256,2);
assertEquals(256,byte2s.cardinality());
assertEquals(-64,byte2s.smallest());
assertEquals(191,byte2s.largest());
assertFalse(byte2s.encodes(-257));
assertFalse(byte2s.encodes(-256));
assertFalse(byte2s.encodes(-255));
assertFalse(byte2s.encodes(-129));
assertFalse(byte2s.encodes(-128));
assertFalse(byte2s.encodes(-127));
assertFalse(byte2s.encodes(-65));
assertTrue(byte2s.encodes(-64));
assertTrue(byte2s.encodes(-64));
assertTrue(byte2s.encodes(-1));
assertTrue(byte2s.encodes(0));
assertTrue(byte2s.encodes(1));
assertTrue(byte2s.encodes(127));
assertTrue(byte2s.encodes(128));
assertTrue(byte2s.encodes(191));
assertFalse(byte2s.encodes(192));
assertFalse(byte2s.encodes(256));
}