Skip to content

Commit 131e0f8

Browse files
authored
[stdlib] validationt test for StrideTo/StrideThrough sequences (#3363)
1 parent 2650afb commit 131e0f8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

validation-test/stdlib/Stride.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %target-run-simple-swift
2+
// REQUIRES: executable_test
3+
4+
import StdlibUnittest
5+
import StdlibCollectionUnittest
6+
7+
var StrideTestSuite = TestSuite("Stride")
8+
9+
StrideTestSuite.test("to") {
10+
checkSequence(Array(0...4), stride(from: 0, to: 5, by: 1))
11+
checkSequence(Array(1...5).reversed(), stride(from: 5, to: 0, by: -1))
12+
}
13+
14+
StrideTestSuite.test("through") {
15+
checkSequence(Array(0...5), stride(from: 0, through: 5, by: 1))
16+
checkSequence(Array(0...5).reversed(), stride(from: 5, through: 0, by: -1))
17+
}
18+
19+
runAllTests()

0 commit comments

Comments
 (0)