@Test public void testStrict() throws Exception { HexDecoder hd = new HexDecoder(); MalformedTestSupport.testMalformed(hd, "00 01", 2, 1); MalformedTestSupport.testMalformed(hd, "00_01", 2, 1); MalformedTestSupport.testMalformed(hd, "00g01", 2, 1); }
@Test public void testMalformedLengths() throws Exception { HexDecoder hd = new HexDecoder(); MalformedTestSupport.testMalformed(hd, "00FFG", 4, 1); MalformedTestSupport.testMalformed(hd, "00FF9G", 4, 2); MalformedTestSupport.testMalformed(hd, "00FFGG00", 4, 1); }
@Test public void testLenientChars() throws Exception { BitSet lenientChars = new BitSet(0x100); lenientChars.set(' '); lenientChars.set('_'); HexDecoder hd = new HexDecoder().setLenientChars(LenientChars.partial(lenientChars)); test(hd, "00 01", new byte[] {0, 1}); test(hd, "00_01", new byte[] {0, 1}); MalformedTestSupport.testMalformed(hd, "00g01", 2, 1); }