Skip to content

Commit 40b7050

Browse files
committed
added test programs for List, Map and BigDecimal
1 parent 42f28c3 commit 40b7050

2 files changed

Lines changed: 92 additions & 35 deletions

File tree

src/test/java/org/msgpack/TestBufferPackBufferUnpack.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.junit.Assert.assertEquals;
55

66
import java.math.BigInteger;
7+
import java.util.List;
78

89
import org.junit.Test;
910
import org.msgpack.packer.BufferPacker;
@@ -181,4 +182,14 @@ public void testByteArray(byte[] v) throws Exception {
181182
byte[] ret = unpacker.readByteArray();
182183
assertArrayEquals(v, ret);
183184
}
185+
186+
@Test @Override
187+
public void testList() throws Exception {
188+
super.testList();
189+
}
190+
191+
@Override
192+
public void testList(List v) throws Exception {
193+
// TODO
194+
}
184195
}

src/test/java/org/msgpack/TestSet.java

Lines changed: 81 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import java.math.BigDecimal;
44
import java.math.BigInteger;
55
import java.nio.ByteBuffer;
6+
import java.util.ArrayList;
67
import java.util.Date;
8+
import java.util.HashMap;
9+
import java.util.List;
10+
import java.util.Map;
711
import java.util.Random;
812

913
import org.junit.Ignore;
@@ -273,41 +277,6 @@ public void testDoubleArray(double[] v) throws Exception {
273277
public void testNil() throws Exception {
274278
}
275279

276-
public void testBigInteger() throws Exception {
277-
// FIXME testBigInteger(null);
278-
testBigInteger(BigInteger.valueOf(0));
279-
testBigInteger(BigInteger.valueOf(-1));
280-
testBigInteger(BigInteger.valueOf(1));
281-
testBigInteger(BigInteger.valueOf(Integer.MIN_VALUE));
282-
testBigInteger(BigInteger.valueOf(Integer.MAX_VALUE));
283-
testBigInteger(BigInteger.valueOf(Long.MIN_VALUE));
284-
testBigInteger(BigInteger.valueOf(Long.MAX_VALUE));
285-
BigInteger max = BigInteger.valueOf(Long.MAX_VALUE).setBit(63);
286-
testBigInteger(max);
287-
Random rand = new Random();
288-
for (int i = 0; i < 1000; i++) {
289-
testBigInteger(max.subtract(BigInteger.valueOf(Math.abs(rand.nextLong()))));
290-
}
291-
}
292-
293-
public void testBigInteger(BigInteger v) throws Exception {
294-
}
295-
296-
public void testBigDecimal() throws Exception {
297-
// FIXME testBigDecimal(null);
298-
testBigDecimal(BigDecimal.valueOf(0));
299-
testBigDecimal(BigDecimal.valueOf(-1));
300-
testBigDecimal(BigDecimal.valueOf(1));
301-
testBigDecimal(BigDecimal.valueOf(Integer.MIN_VALUE));
302-
testBigDecimal(BigDecimal.valueOf(Integer.MAX_VALUE));
303-
testBigDecimal(BigDecimal.valueOf(Long.MIN_VALUE));
304-
testBigDecimal(BigDecimal.valueOf(Long.MAX_VALUE));
305-
// TODO
306-
}
307-
308-
public void testBigDecimal(BigDecimal v) throws Exception {
309-
}
310-
311280
public void testString() throws Exception {
312281
// TODO testString(null);
313282
testString("");
@@ -370,6 +339,83 @@ public void testByteBuffer() throws Exception {
370339
public void testByteBuffer(ByteBuffer v) throws Exception {
371340
}
372341

342+
public void testList() throws Exception {
343+
// FIXME testList(null);
344+
List<Integer> list0 = new ArrayList<Integer>();
345+
testList(list0);
346+
List<Integer> list1 = new ArrayList<Integer>();
347+
Random rand1 = new Random();
348+
for (int i = 0; i < 1000; ++i) {
349+
list1.add(rand1.nextInt());
350+
}
351+
testList(list1);
352+
List<String> list2 = new ArrayList<String>();
353+
Random rand2 = new Random();
354+
for (int i = 0; i < 1000; ++i) {
355+
list2.add("xx" + rand2.nextInt());
356+
}
357+
testList(list2);
358+
}
359+
360+
public void testList(List v) throws Exception {
361+
}
362+
363+
public void testMap() throws Exception {
364+
// FIXME testMap(null);
365+
Map<Integer, Integer> map0 = new HashMap<Integer, Integer>();
366+
testMap(map0);
367+
Map<Integer, Integer> map1 = new HashMap<Integer, Integer>();
368+
Random rand1 = new Random();
369+
for (int i = 0; i < 1000; ++i) {
370+
map1.put(rand1.nextInt(), rand1.nextInt());
371+
}
372+
testMap(map1);
373+
Map<String, Integer> map2 = new HashMap<String, Integer>();
374+
Random rand2 = new Random();
375+
for (int i = 0; i < 1000; ++i) {
376+
map2.put("xx" + rand2.nextInt(), rand2.nextInt());
377+
}
378+
testMap(map2);
379+
}
380+
381+
public void testMap(Map v) throws Exception {
382+
}
383+
384+
public void testBigInteger() throws Exception {
385+
// FIXME testBigInteger(null);
386+
testBigInteger(BigInteger.valueOf(0));
387+
testBigInteger(BigInteger.valueOf(-1));
388+
testBigInteger(BigInteger.valueOf(1));
389+
testBigInteger(BigInteger.valueOf(Integer.MIN_VALUE));
390+
testBigInteger(BigInteger.valueOf(Integer.MAX_VALUE));
391+
testBigInteger(BigInteger.valueOf(Long.MIN_VALUE));
392+
testBigInteger(BigInteger.valueOf(Long.MAX_VALUE));
393+
BigInteger max = BigInteger.valueOf(Long.MAX_VALUE).setBit(63);
394+
testBigInteger(max);
395+
Random rand = new Random();
396+
for (int i = 0; i < 1000; i++) {
397+
testBigInteger(max.subtract(BigInteger.valueOf(Math.abs(rand.nextLong()))));
398+
}
399+
}
400+
401+
public void testBigInteger(BigInteger v) throws Exception {
402+
}
403+
404+
public void testBigDecimal() throws Exception {
405+
// FIXME testBigDecimal(null);
406+
testBigDecimal(BigDecimal.valueOf(0));
407+
testBigDecimal(BigDecimal.valueOf(-1));
408+
testBigDecimal(BigDecimal.valueOf(1));
409+
testBigDecimal(BigDecimal.valueOf(Integer.MIN_VALUE));
410+
testBigDecimal(BigDecimal.valueOf(Integer.MAX_VALUE));
411+
testBigDecimal(BigDecimal.valueOf(Long.MIN_VALUE));
412+
testBigDecimal(BigDecimal.valueOf(Long.MAX_VALUE));
413+
// TODO
414+
}
415+
416+
public void testBigDecimal(BigDecimal v) throws Exception {
417+
}
418+
373419
public void testDate() throws Exception {
374420
// FIXME testDate(null);
375421
Date d0 = new Date();

0 commit comments

Comments
 (0)