public void testZero() { byte[] array = Bytes.toBytes("hello"); Bytes.zero(array); for (int i = 0; i < array.length; i++) { assertEquals(0, array[i]); } array = Bytes.toBytes("hello world"); Bytes.zero(array, 2, 7); assertFalse(array[0] == 0); assertFalse(array[1] == 0); for (int i = 2; i < 9; i++) { assertEquals(0, array[i]); } for (int i = 9; i < array.length; i++) { assertFalse(array[i] == 0); } }
public void testStartsWith() { assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("h"))); assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes(""))); assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("hello"))); assertFalse(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("helloworld"))); assertFalse(Bytes.startsWith(Bytes.toBytes(""), Bytes.toBytes("hello"))); }
public void testCopy() throws Exception { byte [] bytes = Bytes.toBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); byte [] copy = Bytes.copy(bytes); assertFalse(bytes == copy); assertTrue(Bytes.equals(bytes, copy)); }
public void testContains() { byte[] array = Bytes.toBytes("hello world"); assertTrue(Bytes.contains(array, (byte) 'e')); assertTrue(Bytes.contains(array, (byte) 'd')); assertFalse( Bytes.contains(array, (byte) 'a')); assertTrue(Bytes.contains(array, Bytes.toBytes("world"))); assertTrue(Bytes.contains(array, Bytes.toBytes("ello"))); assertFalse(Bytes.contains(array, Bytes.toBytes("owo"))); }
public void testZero() { byte[] array = Bytes.toBytes("hello"); Bytes.zero(array); for (int i = 0; i < array.length; i++) { assertEquals(0, array[i]); } array = Bytes.toBytes("hello world"); Bytes.zero(array, 2, 7); assertFalse(array[0] == 0); assertFalse(array[1] == 0); for (int i = 2; i < 9; i++) { assertEquals(0, array[i]); } for (int i = 9; i < array.length; i++) { assertFalse(array[i] == 0); } }
public void testZero() { byte[] array = Bytes.toBytes("hello"); Bytes.zero(array); for (int i = 0; i < array.length; i++) { assertEquals(0, array[i]); } array = Bytes.toBytes("hello world"); Bytes.zero(array, 2, 7); assertFalse(array[0] == 0); assertFalse(array[1] == 0); for (int i = 2; i < 9; i++) { assertEquals(0, array[i]); } for (int i = 9; i < array.length; i++) { assertFalse(array[i] == 0); } }
public void testStartsWith() { assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("h"))); assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes(""))); assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("hello"))); assertFalse(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("helloworld"))); assertFalse(Bytes.startsWith(Bytes.toBytes(""), Bytes.toBytes("hello"))); }
public void testStartsWith() { assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("h"))); assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes(""))); assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("hello"))); assertFalse(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("helloworld"))); assertFalse(Bytes.startsWith(Bytes.toBytes(""), Bytes.toBytes("hello"))); }
public void testCopy() throws Exception { byte [] bytes = Bytes.toBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); byte [] copy = Bytes.copy(bytes); assertFalse(bytes == copy); assertTrue(Bytes.equals(bytes, copy)); }
public void testCopy() throws Exception { byte [] bytes = Bytes.toBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); byte [] copy = Bytes.copy(bytes); assertFalse(bytes == copy); assertTrue(Bytes.equals(bytes, copy)); }
public void testContains() { byte[] array = Bytes.toBytes("hello world"); assertTrue(Bytes.contains(array, (byte) 'e')); assertTrue(Bytes.contains(array, (byte) 'd')); assertFalse( Bytes.contains(array, (byte) 'a')); assertTrue(Bytes.contains(array, Bytes.toBytes("world"))); assertTrue(Bytes.contains(array, Bytes.toBytes("ello"))); assertFalse(Bytes.contains(array, Bytes.toBytes("owo"))); }
public void testContains() { byte[] array = Bytes.toBytes("hello world"); assertTrue(Bytes.contains(array, (byte) 'e')); assertTrue(Bytes.contains(array, (byte) 'd')); assertFalse( Bytes.contains(array, (byte) 'a')); assertTrue(Bytes.contains(array, Bytes.toBytes("world"))); assertTrue(Bytes.contains(array, Bytes.toBytes("ello"))); assertFalse(Bytes.contains(array, Bytes.toBytes("owo"))); }