@@ -23,11 +23,39 @@ def test_combinatorica():
2323 r"{{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}"
2424 )
2525 for str_expr , str_expected , message in (
26+ (
27+ "Permute[{a, b, c, d}, Range[4]]" ,
28+ "{a, b, c, d}" ,
29+ "Permute list with simple list" ,
30+ ),
31+ (
32+ "Permute[{a, b, c, d}, {1,2,2,4}]" ,
33+ "Permute[{a, b, c, d}, {1,2,2,4}]" ,
34+ "Incorrect permute: index 2 duplicated" ,
35+ ),
2636 (
2737 "Permute[{A, B, C, D}, %s]" % permutations3 ,
2838 "{{A, B, C}, {A, C, B}, {B, A, C}, {B, C, A}, {C, A, B}, {C, B, A}}" ,
2939 "Permute" ,
3040 ),
41+ (
42+ "LexicographicPermutations[{a,b,c,d}]" ,
43+ "{{a, b, c, d}, {a, b, d, c}, {a, c, b, d}, "
44+ "{a, c, d, b}, {a, d, b, c}, {a, d, c, b}, "
45+ "{b, a, c, d}, {b, a, d, c}, {b, c, a, d}, "
46+ "{b, c, d, a}, {b, d, a, c}, {b, d, c, a}, "
47+ "{c, a, b, d}, {c, a, d, b}, {c, b, a, d}, "
48+ "{c, b, d, a}, {c, d, a, b}, {c, d, b, a}, "
49+ "{d, a, b, c}, {d, a, c, b}, {d, b, a, c}, "
50+ "{d, b, c, a}, {d, c, a, b}, {d, c, b, a}}" ,
51+ "LexicographicPermuations"
52+ ),
53+
54+ ("Map[RankPermutation, Permutations[Range[4]]]" ,
55+ "Range[0, 23]" ,
56+ "Permutations uses lexographic order"
57+ ),
58+
3159 ("RankPermutation[{8, 9, 7, 1, 6, 4, 5, 3, 2}]" , "321953" , "RankPermutation" ),
3260 (
3361 "Permute[{5,2,4,3,1}, InversePermutation[{5,2,4,3,1}]]" ,
@@ -40,7 +68,7 @@ def test_combinatorica():
4068 "MinimumChangePermuations" ,
4169 ),
4270 (
43- "Subsets[{1,2,3} ]" ,
71+ "Subsets[Range[3] ]" ,
4472 "{{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}" ,
4573 "Subsets" ,
4674 ),
@@ -71,7 +99,7 @@ def test_combinatorica():
7199 "BinarySearch - find where key is a list" ,
72100 ),
73101 (
74- "KSubsets[{1,2,3,4,5}, 3]" ,
102+ "KSubsets[Range[5], 3]" ,
75103 "{{1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5}, {1, 4, 5}, "
76104 "{2, 3, 4}, {2, 3, 5}, {2, 4, 5}, {3, 4, 5}}" ,
77105 "Ksubsets" ,
0 commit comments