Skip to content

Commit 6b1c8e6

Browse files
mdznrMatt Zanchelli
authored andcommitted
Add partitioningIndex(where:) unit tests for empty input
1 parent ac99505 commit 6b1c8e6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Tests/SwiftAlgorithmsTests/PartitionTests.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ final class PartitionTests: XCTestCase {
9292
}
9393
}
9494

95+
func testPartitioningIndexWithEmptyInput() {
96+
let input: [Int] = []
97+
98+
let a = input.partitioningIndex(where: { _ in return true })
99+
XCTAssertEqual(a, input.startIndex)
100+
101+
let b = input.partitioningIndex(where: { _ in return false })
102+
XCTAssertEqual(b, input.endIndex)
103+
}
104+
95105
func testPartitionWithSubrangeBidirectionalCollection() {
96106
for length in 10...20 {
97107
let a = Array(0..<length)

0 commit comments

Comments
 (0)