source: src/test/java/list/OuterTest.java@ 127

Last change on this file since 127 was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 2.1 KB
Line 
1package list;
2
3import static org.junit.Assert.assertEquals;
4
5import java.math.BigInteger;
6import java.util.Arrays;
7
8import org.junit.Test;
9
10import genius.core.list.ImArrayList;
11import genius.core.list.Outer;
12
13public class OuterTest {
14
15 static ImArrayList<String> list1 = new ImArrayList<String>(Arrays.asList(new String[] { "a", "b" }));
16 static ImArrayList<String> list2 = new ImArrayList<String>(Arrays.asList(new String[] { "c", "d" }));
17 static ImArrayList<String> list3 = new ImArrayList<String>(Arrays.asList(new String[] {}));
18 static ImArrayList<String> list4 = new ImArrayList<String>(Arrays.asList(new String[] { "e" }));
19 static ImArrayList<String> list5 = new ImArrayList<String>(Arrays.asList(new String[] { "f", "g", "h" }));
20 static ImArrayList<String> list6 = new ImArrayList<String>(Arrays.asList(new String[] { "i" }));
21
22 @Test
23 public void test() {
24 Outer<String> p = new Outer<String>(list1, list2);
25 assertEquals(BigInteger.valueOf(4), p.size());
26 assertEquals("[[a, c],[b, c],[a, d],[b, d]]", p.toString());
27 System.out.println("data=" + p + "\n");
28 }
29
30 @Test
31 public void testEmpty() {
32
33 Outer<String> p = new Outer<String>(list1, list2, list3);
34 assertEquals(BigInteger.valueOf(0), p.size());
35 }
36
37 @Test
38 public void testEmpty2() {
39 Outer<String> p = new Outer<String>();
40 assertEquals(BigInteger.valueOf(0), p.size());
41 }
42
43 @Test
44 public void test2() {
45 Outer<String> p = new Outer<String>(list1, list4);
46 assertEquals(BigInteger.valueOf(2), p.size());
47 assertEquals("[[a, e],[b, e]]", p.toString());
48 System.out.println("data=" + p + "\n");
49 }
50
51 @Test
52 public void test3() {
53 Outer<String> p = new Outer<String>(list1, list2, list5);
54 assertEquals(BigInteger.valueOf(2 * 2 * 3), p.size());
55 System.out.println("data=" + p + "\n");
56 assertEquals(
57 "[[a, c, f],[b, c, f],[a, d, f],[b, d, f],[a, c, g],[b, c, g],[a, d, g],[b, d, g],[a, c, h],[b, c, h],[a, d, h],[b, d, h]]",
58 p.toString());
59 }
60
61 @Test
62 public void testSmall() {
63 Outer<String> p = new Outer<String>(list4, list6);
64 System.out.println("data=" + p + "\n");
65 assertEquals(BigInteger.ONE, p.size());
66 assertEquals("[[e, i]]", p.toString());
67 }
68
69}
Note: See TracBrowser for help on using the repository browser.