Skip to content

Commit b62bf2d

Browse files
author
Tom Wilkie
committed
Test for byte[][]
1 parent 7401974 commit b62bf2d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/test/java/org/msgpack/TestSimpleArrays.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public void testGenerics() throws Exception {
262262
@Message
263263
public static class Dim2Test {
264264
public int[][] i;
265+
public byte[][] b;
265266
public String[][] str;
266267
public List<String>[][] slist;
267268

@@ -277,6 +278,9 @@ public void testDim2() throws Exception {
277278
t.i = new int[2][];
278279
t.i[0] = new int[] { 0, 1 };
279280
t.i[1] = new int[] { 2, 3, 4 };
281+
t.b = new byte[2][];
282+
t.b[0] = new byte[] { 5, 6 };
283+
t.b[1] = new byte[] { 7, 8, 9 };
280284
t.str = new String[2][];
281285
t.str[0] = new String[] { "aa", "bb" };
282286
t.str[1] = new String[] { "cc", "dd", "ee" };
@@ -298,21 +302,28 @@ public void testDim2() throws Exception {
298302
byte[] raw = packer.toByteArray();
299303
BufferUnpacker unpacker = msgpack.createBufferUnpacker(raw);
300304
Dim2Test u = unpacker.read(Dim2Test.class);
301-
assertEquals(t.i.length, t.i.length);
305+
assertEquals(t.i.length, u.i.length);
302306
for (int i = 0; i < t.i.length; i++) {
303307
assertEquals(t.i[i].length, u.i[i].length);
304308
for (int j = 0; j < t.i[i].length; j++) {
305309
assertEquals(t.i[i][j], u.i[i][j]);
306310
}
307311
}
308-
assertEquals(t.str.length, t.str.length);
312+
assertEquals(t.b.length, u.b.length);
313+
for (int i = 0; i < t.b.length; i++) {
314+
assertEquals(t.b[i].length, u.b[i].length);
315+
for (int j = 0; j < t.i[i].length; j++) {
316+
assertEquals(t.b[i][j], u.b[i][j]);
317+
}
318+
}
319+
assertEquals(t.str.length, u.str.length);
309320
for (int i = 0; i < t.str.length; i++) {
310321
assertEquals(t.str[i].length, u.str[i].length);
311322
for (int j = 0; j < t.str[i].length; j++) {
312323
assertEquals(t.str[i][j], u.str[i][j]);
313324
}
314325
}
315-
assertEquals(t.slist.length, t.slist.length);
326+
assertEquals(t.slist.length, u.slist.length);
316327
for (int i = 0; i < t.slist.length; i++) {
317328
assertEquals(t.slist[i].length, u.slist[i].length);
318329
for (int j = 0; j < t.slist[i].length; j++) {

0 commit comments

Comments
 (0)