Skip to content

Commit 62096e1

Browse files
authored
Update PartialSortTests.swift
1 parent 1d22ef9 commit 62096e1

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

Tests/SwiftAlgorithmsTests/PartialSortTests.swift

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,34 @@ final class PartialSortTests: XCTestCase {
127127
assertStability([1,1,1,2,5,7,3,6,2,5,7,3,6], withPrefix: 6)
128128
assertStability([1,1,1,2,5,7,3,6,2,5,7,3,6], withPrefix: 20)
129129
assertStability([1,1,1,2,5,7,3,6,2,5,7,3,6], withPrefix: 1000)
130+
assertStability([0,0,0,0,0], withPrefix: 0)
131+
assertStability([0,0,0,0,0], withPrefix: 1)
132+
assertStability([0,0,0,0,0], withPrefix: 2)
133+
assertStability([0,0,0,0,0], withPrefix: 5)
134+
assertStability([0,0], withPrefix: 1)
135+
assertStability([0,0], withPrefix: 2)
136+
assertStability([0,1,0,1,0,1], withPrefix: 2)
137+
assertStability([0,1,0,1,0,1], withPrefix: 6)
138+
assertStability([0,0,0,1,1,1], withPrefix: 1)
139+
assertStability([0,0,0,1,1,1], withPrefix: 3)
140+
assertStability([0,0,0,1,1,1], withPrefix: 4)
141+
assertStability([0,0,0,1,1,1], withPrefix: 6)
142+
assertStability([1,1,1,0,0,0], withPrefix: 1)
143+
assertStability([1,1,1,0,0,0], withPrefix: 3)
144+
assertStability([1,1,1,0,0,0], withPrefix: 4)
145+
assertStability([1,1,1,0,0,0], withPrefix: 6)
130146
}
131147

132148
func assertStability(
133149
_ actual: [Int],
134-
withPrefix prefixCount: Int,
135-
file: StaticString = #file,
136-
line: UInt = #line
150+
withPrefix prefixCount: Int
137151
) {
138152
let indexed = actual.enumerated()
139-
let sorted = indexed.map { $0 } .sortedPrefix(prefixCount) { $0.element < $1.element }
153+
let sorted = indexed.map { $0 }.sortedPrefix(prefixCount) { $0.element < $1.element }
140154

141155
for element in Set(actual) {
142156
let filtered = sorted.filter { $0.element == element }.map(\.offset)
143157
XCTAssertEqual(filtered, filtered.sorted())
144-
}
158+
}
145159
}
146160
}

0 commit comments

Comments
 (0)