public void testEncodeDecodeEmptyBlock() throws CHKEncodeException, CHKVerifyException, CHKDecodeException, UnsupportedEncodingException, InvalidCompressionCodecException, IOException { byte[] buf = new byte[0]; checkBlock(buf, false); checkBlock(buf, true); }
public void testEncodeDecodeShortInteger() throws CHKEncodeException, CHKVerifyException, CHKDecodeException, UnsupportedEncodingException, InvalidCompressionCodecException, IOException { for(int i=0;i<100;i++) { String s = Integer.toString(i); checkBlock(s.getBytes("UTF-8"), false); checkBlock(s.getBytes("UTF-8"), true); } }
public void testEncodeDecodeNearlyFullBlock() throws CHKEncodeException, CHKVerifyException, CHKDecodeException, UnsupportedEncodingException, InvalidCompressionCodecException, IOException { MersenneTwister random = new MersenneTwister(68); for(int i=0;i<10;i++) { byte[] buf = new byte[CHKBlock.DATA_LENGTH - i]; random.nextBytes(buf); checkBlock(buf, false); checkBlock(buf, true); } for(int i=0;i<10;i++) { byte[] buf = new byte[CHKBlock.DATA_LENGTH - (1<<i)]; random.nextBytes(buf); checkBlock(buf, false); checkBlock(buf, true); } }
public void testEncodeDecodeFullBlock() throws CHKEncodeException, CHKVerifyException, CHKDecodeException, UnsupportedEncodingException, InvalidCompressionCodecException, IOException { byte[] fullBlock = new byte[CHKBlock.DATA_LENGTH]; MersenneTwister random = new MersenneTwister(42); for(int i=0;i<10;i++) { random.nextBytes(fullBlock); checkBlock(fullBlock, false); checkBlock(fullBlock, true); } }
public void testEncodeDecodeRandomLength() throws CHKEncodeException, CHKVerifyException, CHKDecodeException, UnsupportedEncodingException, InvalidCompressionCodecException, IOException { MersenneTwister random = new MersenneTwister(42); for(int i=0;i<10;i++) { byte[] buf = new byte[random.nextInt(CHKBlock.DATA_LENGTH+1)]; random.nextBytes(buf); checkBlock(buf, false); checkBlock(buf, true); } }