|
9 | 9 | // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
10 | 10 | //
|
11 | 11 | //===----------------------------------------------------------------------===//
|
12 |
| -// RUN: %target-run-stdlib-swift | FileCheck %s |
| 12 | +// RUN: %target-run-simple-swift |
13 | 13 | // REQUIRES: executable_test
|
14 | 14 |
|
| 15 | +import StdlibUnittest |
15 | 16 | import Swift
|
16 | 17 |
|
17 | 18 | //===--- class Tracked ----------------------------------------------------===//
|
@@ -81,40 +82,22 @@ struct MrMcRange : Collection {
|
81 | 82 | var base: Base
|
82 | 83 | }
|
83 | 84 |
|
84 |
| -func printSequence<T : Sequence>(x: T) { |
85 |
| - print("<", terminator: "") |
86 |
| - var prefix = "" |
87 |
| - for a in x { |
88 |
| - print(prefix, terminator: "") |
89 |
| - print(a, terminator: "") |
90 |
| - prefix = " " |
91 |
| - } |
92 |
| - print(">") |
93 |
| -} |
94 |
| - |
95 |
| - |
96 |
| - |
97 |
| -// CHECK: testing... |
98 |
| -print("testing...") |
| 85 | +let ArrayCoreTests = TestSuite("ArrayCore") |
99 | 86 |
|
100 |
| -func test() { |
101 |
| - //===--- Sequences can be converted -------------------------------------===// |
102 |
| - |
103 |
| - let n0 = ((Tracked(10)..<Tracked(27)).makeIterator())._copyToNativeArrayBuffer() |
104 |
| - // CHECK-NEXT: <10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26> |
105 |
| - printSequence(n0) |
106 |
| - |
107 |
| - //===--- Collections get measured ---------------------------------------===// |
| 87 | +ArrayCoreTests.test("Sequences can be converted") { |
| 88 | + let n = ((Tracked(10)..<Tracked(27)).makeIterator())._copyToNativeArrayBuffer() |
| 89 | + let out = n.map { "\($0)" }.joined(separator: " ") |
| 90 | + expectPrinted("10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26", out) |
| 91 | +} |
108 | 92 |
|
109 |
| - // CHECK-NEXT: using collection API |
110 |
| - let n1 = MrMcRange(3..<23)._copyToNativeArrayBuffer() |
111 |
| - // CHECK: <3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22> |
112 |
| - printSequence(n1) |
| 93 | +ArrayCoreTests.test("Collections get measured") { |
| 94 | + let n = MrMcRange(3..<23)._copyToNativeArrayBuffer() |
| 95 | + let out = n.map { "\($0)" }.joined(separator: " ") |
| 96 | + expectPrinted("3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22", out) |
113 | 97 | }
|
114 |
| -test() |
115 | 98 |
|
116 |
| -// CHECK-NEXT: trackedCount = 0 |
117 |
| -print("trackedCount = \(trackedCount)") |
| 99 | +ArrayCoreTests.test("Check trackedCount") { |
| 100 | + expectEqual(0, trackedCount) |
| 101 | +} |
118 | 102 |
|
119 |
| -// CHECK-NEXT: done. |
120 |
| -print("done.") |
| 103 | +runAllTests() |
0 commit comments