@Test public void primitiveArrays_subset_offsetOutOfRange() { byte[] values = (byte[]) getPrimitiveArrayData(30)[1]; buf.setPrintDescription(true).appendArray(values, 40, 40); result += "byte[30] []"; assertEquals(result, buf.toString()); }
@Test public void primitiveArrays_subset() { byte[] values = (byte[]) getPrimitiveArrayData(30)[1]; buf.setPrintDescription(true).appendArray(values, 2, 20); result += "byte[30] [\n"; result += " [03-12/30] 02 03 04 05 06 07 08 09 0a 0b\n"; result += " [13-22/30] 0c 0d 0e 0f 10 11 12 13 14 15\n"; result += "]"; assertEquals(result, buf.toString()); }
@Test public void primitiveArrays_multilines_desc() { Object[] values = getPrimitiveArrayData(18); buf.setPrintDescription(true).append(values); result += "java.lang.Object[9] [\n"; result += " [1/9] boolean[18] [\n"; result += " [01-10/18] true false true false true false true false true false\n"; result += " [11-18/18] true false true false true false true false\n"; result += " ]\n"; result += " [2/9] byte[18] [\n"; result += " [01-10/18] 00 01 02 03 04 05 06 07 08 09\n"; result += " [11-18/18] 0a 0b 0c 0d 0e 0f 10 11\n"; result += " ]\n"; result += " [3/9] char[18] [\n"; result += " [01-10/18] 0 1 2 3 4 5 6 7 8 9\n"; result += " [11-18/18] : ; < = > ? @ A\n"; result += " ]\n"; result += " [4/9] double[18] [\n"; result += " [01-10/18] 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0\n"; result += " [11-18/18] 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0\n"; result += " ]\n"; result += " [5/9] float[18] [\n"; result += " [01-10/18] 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0\n"; result += " [11-18/18] 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0\n"; result += " ]\n"; result += " [6/9] int[18] [\n"; result += " [01-10/18] 0 1 2 3 4 5 6 7 8 9\n"; result += " [11-18/18] 10 11 12 13 14 15 16 17\n"; result += " ]\n"; result += " [7/9] long[18] [\n"; result += " [01-10/18] 0 1 2 3 4 5 6 7 8 9\n"; result += " [11-18/18] 10 11 12 13 14 15 16 17\n"; result += " ]\n"; result += " [8/9] short[18] [\n"; result += " [01-10/18] 0 1 2 3 4 5 6 7 8 9\n"; result += " [11-18/18] 10 11 12 13 14 15 16 17\n"; result += " ]\n"; result += " [9/9] aaa\n"; result += " bbb\n"; result += " ccc\n"; result += "]"; assertEquals(result, buf.toString()); }
@Test public void primitiveArrays_oneline_desc() { Object[] values = getPrimitiveArrayData(8); buf.setPrintDescription(true).append(values); result += "java.lang.Object[9] [\n"; result += " [1/9] boolean[8] [true, false, true, false, true, false, true, false]\n"; result += " [2/9] byte[8] [0, 1, 2, 3, 4, 5, 6, 7]\n"; result += " [3/9] char[8] [0, 1, 2, 3, 4, 5, 6, 7]\n"; result += " [4/9] double[8] [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]\n"; result += " [5/9] float[8] [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]\n"; result += " [6/9] int[8] [0, 1, 2, 3, 4, 5, 6, 7]\n"; result += " [7/9] long[8] [0, 1, 2, 3, 4, 5, 6, 7]\n"; result += " [8/9] short[8] [0, 1, 2, 3, 4, 5, 6, 7]\n"; result += " [9/9] aaa\n"; result += " bbb\n"; result += " ccc\n"; result += "]"; assertEquals(result, buf.toString()); }