@@ -31,40 +31,40 @@ final class CombinationsTests: XCTestCase {
31
31
let c4 = c. combinations ( ofCount: 4 ) . count
32
32
XCTAssertEqual ( c4, 1 )
33
33
34
- let c5 = c. combinations ( ofCounts : 0 ... 0 ) . count
34
+ let c5 = c. combinations ( ofCount : 0 ... 0 ) . count
35
35
XCTAssertEqual ( c5, 1 )
36
36
37
- let c6 = c. combinations ( ofCounts : 1 ... 1 ) . count
37
+ let c6 = c. combinations ( ofCount : 1 ... 1 ) . count
38
38
XCTAssertEqual ( c6, 4 )
39
39
40
- let c7 = c. combinations ( ofCounts : 1 ... 2 ) . count
40
+ let c7 = c. combinations ( ofCount : 1 ... 2 ) . count
41
41
XCTAssertEqual ( c7, 10 )
42
42
43
- let c8 = c. combinations ( ofCounts : 1 ... 3 ) . count
43
+ let c8 = c. combinations ( ofCount : 1 ... 3 ) . count
44
44
XCTAssertEqual ( c8, 14 )
45
45
46
- let c9 = c. combinations ( ofCounts : 2 ... 4 ) . count
46
+ let c9 = c. combinations ( ofCount : 2 ... 4 ) . count
47
47
XCTAssertEqual ( c9, 11 )
48
48
49
49
// `k` greater than element count results in same number of combinations
50
- let c10 = c. combinations ( ofCounts : 3 ... 10 ) . count
50
+ let c10 = c. combinations ( ofCount : 3 ... 10 ) . count
51
51
XCTAssertEqual ( c10, 5 )
52
52
53
53
// `k` greater than element count results in same number of combinations
54
- let c11 = c. combinations ( ofCounts : 4 ... 10 ) . count
54
+ let c11 = c. combinations ( ofCount : 4 ... 10 ) . count
55
55
XCTAssertEqual ( c11, 1 )
56
56
57
57
// `k` entirely greater than element count results in no combinations
58
- let c12 = c. combinations ( ofCounts : 5 ... 10 ) . count
58
+ let c12 = c. combinations ( ofCount : 5 ... 10 ) . count
59
59
XCTAssertEqual ( c12, 0 )
60
60
61
- let c13 = c. combinations ( ofCounts : 0 ... ) . count
61
+ let c13 = c. combinations ( ofCount : 0 ... ) . count
62
62
XCTAssertEqual ( c13, 16 )
63
63
64
- let c14 = c. combinations ( ofCounts : ... 3 ) . count
64
+ let c14 = c. combinations ( ofCount : ... 3 ) . count
65
65
XCTAssertEqual ( c14, 15 )
66
66
67
- let c15 = c. combinations ( ofCounts : 0 ... ) . count
67
+ let c15 = c. combinations ( ofCount : 0 ... ) . count
68
68
XCTAssertEqual ( c15, 16 )
69
69
}
70
70
@@ -83,44 +83,44 @@ final class CombinationsTests: XCTestCase {
83
83
let c4 = c. combinations ( ofCount: 4 )
84
84
XCTAssertEqual ( [ " ABCD " ] , c4. map { String ( $0) } )
85
85
86
- let c5 = c. combinations ( ofCounts : 2 ... 4 )
86
+ let c5 = c. combinations ( ofCount : 2 ... 4 )
87
87
XCTAssertEqual ( [ " AB " , " AC " , " AD " , " BC " , " BD " , " CD " , " ABC " , " ABD " , " ACD " , " BCD " , " ABCD " ] , c5. map { String ( $0) } )
88
88
89
- let c6 = c. combinations ( ofCounts : 0 ... 4 )
89
+ let c6 = c. combinations ( ofCount : 0 ... 4 )
90
90
XCTAssertEqual ( [ " " , " A " , " B " , " C " , " D " , " AB " , " AC " , " AD " , " BC " , " BD " , " CD " , " ABC " , " ABD " , " ACD " , " BCD " , " ABCD " ] , c6. map { String ( $0) } )
91
91
92
- let c7 = c. combinations ( ofCounts : 0 ... )
92
+ let c7 = c. combinations ( ofCount : 0 ... )
93
93
XCTAssertEqual ( [ " " , " A " , " B " , " C " , " D " , " AB " , " AC " , " AD " , " BC " , " BD " , " CD " , " ABC " , " ABD " , " ACD " , " BCD " , " ABCD " ] , c7. map { String ( $0) } )
94
94
95
- let c8 = c. combinations ( ofCounts : ... 4 )
95
+ let c8 = c. combinations ( ofCount : ... 4 )
96
96
XCTAssertEqual ( [ " " , " A " , " B " , " C " , " D " , " AB " , " AC " , " AD " , " BC " , " BD " , " CD " , " ABC " , " ABD " , " ACD " , " BCD " , " ABCD " ] , c8. map { String ( $0) } )
97
97
98
- let c9 = c. combinations ( ofCounts : ... 3 )
98
+ let c9 = c. combinations ( ofCount : ... 3 )
99
99
XCTAssertEqual ( [ " " , " A " , " B " , " C " , " D " , " AB " , " AC " , " AD " , " BC " , " BD " , " CD " , " ABC " , " ABD " , " ACD " , " BCD " ] , c9. map { String ( $0) } )
100
100
101
- let c10 = c. combinations ( ofCounts : 1 ... )
101
+ let c10 = c. combinations ( ofCount : 1 ... )
102
102
XCTAssertEqual ( [ " A " , " B " , " C " , " D " , " AB " , " AC " , " AD " , " BC " , " BD " , " CD " , " ABC " , " ABD " , " ACD " , " BCD " , " ABCD " ] , c10. map { String ( $0) } )
103
103
}
104
104
105
105
func testEmpty( ) {
106
106
// `k == 0` results in one zero-length combination
107
107
XCTAssertEqualSequences ( [ [ ] ] , " " . combinations ( ofCount: 0 ) )
108
- XCTAssertEqualSequences ( [ [ ] ] , " " . combinations ( ofCounts : 0 ... 0 ) )
108
+ XCTAssertEqualSequences ( [ [ ] ] , " " . combinations ( ofCount : 0 ... 0 ) )
109
109
XCTAssertEqualSequences ( [ [ ] ] , " ABCD " . combinations ( ofCount: 0 ) )
110
- XCTAssertEqualSequences ( [ [ ] ] , " ABCD " . combinations ( ofCounts : 0 ... 0 ) )
110
+ XCTAssertEqualSequences ( [ [ ] ] , " ABCD " . combinations ( ofCount : 0 ... 0 ) )
111
111
112
112
// `k` greater than element count results in zero combinations
113
113
XCTAssertEqualSequences ( [ ] , " " . combinations ( ofCount: 5 ) )
114
- XCTAssertEqualSequences ( [ ] , " " . combinations ( ofCounts : 5 ... 10 ) )
114
+ XCTAssertEqualSequences ( [ ] , " " . combinations ( ofCount : 5 ... 10 ) )
115
115
XCTAssertEqualSequences ( [ ] , " ABCD " . combinations ( ofCount: 5 ) )
116
- XCTAssertEqualSequences ( [ ] , " ABCD " . combinations ( ofCounts : 5 ... 10 ) )
116
+ XCTAssertEqualSequences ( [ ] , " ABCD " . combinations ( ofCount : 5 ... 10 ) )
117
117
}
118
118
119
119
func testCombinationsLazy( ) {
120
120
XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCount: 1 ) )
121
- XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCounts : 1 ... 3 ) )
122
- XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCounts : 1 ... ) )
123
- XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCounts : ... 3 ) )
124
- XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCounts : 0 ... ) )
121
+ XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCount : 1 ... 3 ) )
122
+ XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCount : 1 ... ) )
123
+ XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCount : ... 3 ) )
124
+ XCTAssertLazySequence ( " ABC " . lazy. combinations ( ofCount : 0 ... ) )
125
125
}
126
126
}
0 commit comments