Skip to content

Commit 4c03fb7

Browse files
author
Tim Vermeulen
committed
Add SubSequence test coverage
1 parent d976bc4 commit 4c03fb7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Tests/SwiftAlgorithmsTests/TestUtilities.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,5 +350,17 @@ func validateIndexTraversals<C>(
350350
}
351351
}
352352
}
353+
354+
// slices
355+
for (startOffset, start) in indicesIncludingEnd.enumerated() {
356+
for (endOffset, end) in indicesIncludingEnd.enumerated().dropFirst(startOffset) {
357+
let slice = c[start..<end]
358+
359+
XCTAssertEqual(slice.isEmpty, startOffset == endOffset)
360+
XCTAssertEqual(slice.count, endOffset - startOffset)
361+
XCTAssertEqual(slice.startIndex, start)
362+
XCTAssertEqual(slice.endIndex, end)
363+
}
364+
}
353365
}
354366
}

0 commit comments

Comments
 (0)