File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Tests/SwiftAlgorithmsTests Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,9 @@ extension AdjacentPairsSequence: Sequence {
113
113
}
114
114
}
115
115
116
+ extension AdjacentPairsSequence : LazySequenceProtocol
117
+ where Base: LazySequenceProtocol { }
118
+
116
119
/// A collection of adjacent pairs of elements built from an underlying
117
120
/// collection.
118
121
///
@@ -299,6 +302,9 @@ extension AdjacentPairsCollection: BidirectionalCollection
299
302
extension AdjacentPairsCollection : RandomAccessCollection
300
303
where Base: RandomAccessCollection { }
301
304
305
+ extension AdjacentPairsCollection : LazySequenceProtocol , LazyCollectionProtocol
306
+ where Base: LazyCollectionProtocol { }
307
+
302
308
extension AdjacentPairsCollection . Index : Hashable where Base. Index: Hashable {
303
309
@inlinable
304
310
public func hash( into hasher: inout Hasher ) {
Original file line number Diff line number Diff line change @@ -72,4 +72,9 @@ final class AdjacentPairsTests: XCTestCase {
72
72
func testIndexTraversals( ) {
73
73
validateIndexTraversals ( ( 1 ... 5 ) . adjacentPairs ( ) )
74
74
}
75
+
76
+ func testLaziness( ) {
77
+ XCTAssertLazySequence ( ( 0 ... ) . lazy. adjacentPairs ( ) )
78
+ XCTAssertLazyCollection ( ( 0 ..< 100 ) . lazy. adjacentPairs ( ) )
79
+ }
75
80
}
You can’t perform that action at this time.
0 commit comments