1 | from unittest.case import TestCase
|
---|
2 | from tudelft.utilities.immutablelist.FixedList import FixedList
|
---|
3 | from tudelft.utilities.immutablelist.PermutationsOrderedWithoutReturn import PermutationsOrderedWithoutReturn
|
---|
4 |
|
---|
5 |
|
---|
6 | class PermutationOrderedWithoutReturnTest(TestCase):
|
---|
7 | def test1(self):
|
---|
8 | source:FixedList[str] = FixedList([ "a", "b", "c" ])
|
---|
9 | p:PermutationsOrderedWithoutReturn[str] = PermutationsOrderedWithoutReturn(source, 1)
|
---|
10 | self.assertEqual(3, p.size())
|
---|
11 | print("data=" + str(p) + "\n")
|
---|
12 | self.assertEqual("[['c'],['b'],['a']]", str(p))
|
---|
13 |
|
---|
14 | def test2(self):
|
---|
15 | source:FixedList[str] = FixedList([ "a", "b", "c", "d"])
|
---|
16 | p:PermutationsOrderedWithoutReturn[str] = PermutationsOrderedWithoutReturn(source, 2)
|
---|
17 | self.assertEqual(6, p.size())
|
---|
18 | print("data=" + str(p) + "\n")
|
---|
19 | self.assertEqual("[['c', 'd'],['b', 'd'],['b', 'c'],['a', 'd'],['a', 'c'],['a', 'b']]", str(p))
|
---|