@@ -255,5 +255,25 @@ StrideTestSuite.test("StrideToIterator/past end/backward") {
255255 strideIteratorTest ( stride ( from: 3 , to: 0 , by: - 1 ) , nonNilResults: 3 )
256256}
257257
258+ StrideTestSuite . test ( " Contains " ) {
259+ expectTrue ( stride ( from: 1 , through: 5 , by: 1 ) . contains ( 3 ) )
260+ expectTrue ( stride ( from: 1 , to: 5 , by: 1 ) . contains ( 3 ) )
261+ expectTrue ( stride ( from: 1 , through: 5 , by: 1 ) . contains ( 5 ) )
262+ expectFalse ( stride ( from: 1 , to: 5 , by: 1 ) . contains ( 5 ) )
263+ expectFalse ( stride ( from: 1 , through: 5 , by: - 1 ) . contains ( 3 ) )
264+ expectFalse ( stride ( from: 1 , to: 5 , by: - 1 ) . contains ( 3 ) )
265+ expectFalse ( stride ( from: 1 , through: 5 , by: - 1 ) . contains ( 1 ) )
266+ expectFalse ( stride ( from: 1 , to: 5 , by: - 1 ) . contains ( 1 ) )
267+
268+ expectTrue ( stride ( from: 5 , through: 1 , by: - 1 ) . contains ( 3 ) )
269+ expectTrue ( stride ( from: 5 , to: 1 , by: - 1 ) . contains ( 3 ) )
270+ expectTrue ( stride ( from: 5 , through: 1 , by: - 1 ) . contains ( 1 ) )
271+ expectFalse ( stride ( from: 5 , to: 1 , by: - 1 ) . contains ( 1 ) )
272+ expectFalse ( stride ( from: 5 , through: 1 , by: 1 ) . contains ( 3 ) )
273+ expectFalse ( stride ( from: 5 , to: 1 , by: 1 ) . contains ( 3 ) )
274+ expectFalse ( stride ( from: 5 , through: 1 , by: 1 ) . contains ( 5 ) )
275+ expectFalse ( stride ( from: 5 , to: 1 , by: 1 ) . contains ( 5 ) )
276+ }
277+
258278runAllTests ( )
259279
0 commit comments