1 | package list;
|
---|
2 |
|
---|
3 | import static org.junit.Assert.assertEquals;
|
---|
4 |
|
---|
5 | import java.math.BigInteger;
|
---|
6 | import java.util.Arrays;
|
---|
7 |
|
---|
8 | import org.junit.Test;
|
---|
9 |
|
---|
10 | import genius.core.list.ImArrayList;
|
---|
11 | import genius.core.list.PermutationsOrderedWithoutReturn;
|
---|
12 |
|
---|
13 | public class PermutationOrderedWithoutReturnTest {
|
---|
14 | @Test
|
---|
15 | public void test1() {
|
---|
16 | ImArrayList<String> source = new ImArrayList<String>(Arrays.asList(new String[] { "a", "b", "c" }));
|
---|
17 | PermutationsOrderedWithoutReturn<String> p = new PermutationsOrderedWithoutReturn<String>(source, 1);
|
---|
18 | assertEquals(BigInteger.valueOf(3), p.size());
|
---|
19 | System.out.println("data=" + p + "\n");
|
---|
20 | assertEquals("[[c],[b],[a]]", p.toString());
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Test
|
---|
24 | public void test2() {
|
---|
25 | ImArrayList<String> source = new ImArrayList<String>(Arrays.asList(new String[] { "a", "b", "c", "d" }));
|
---|
26 | PermutationsOrderedWithoutReturn<String> p = new PermutationsOrderedWithoutReturn<String>(source, 2);
|
---|
27 | assertEquals(BigInteger.valueOf(6), p.size());
|
---|
28 | System.out.println("data=" + p + "\n");
|
---|
29 | assertEquals("[[c, d],[b, d],[b, c],[a, d],[a, c],[a, b]]", p.toString());
|
---|
30 | }
|
---|
31 |
|
---|
32 | }
|
---|