source: utilitiespy/test/immutablelist/PermutationOrderedWithoutReturnTest.py

Last change on this file was 1343, checked in by wouter, 5 weeks ago

#413 added Permutations

File size: 873 bytes
Line 
1from unittest.case import TestCase
2from tudelft.utilities.immutablelist.FixedList import FixedList
3from tudelft.utilities.immutablelist.PermutationsOrderedWithoutReturn import PermutationsOrderedWithoutReturn
4
5
6class 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))
Note: See TracBrowser for help on using the repository browser.