1
1
// RUN: %target-run-simple-swift
2
2
// REQUIRES: executable_test
3
-
4
- // rdar://106656555
5
- // REQUIRES: rdar106656555
3
+ // END.
6
4
7
5
import StdlibUnittest
8
6
@@ -47,14 +45,14 @@ UnsafeMutableBufferPointerSliceTests.test(
47
45
$0 [ i] . 0 += 1
48
46
}
49
47
}
50
- expectEqual ( mb. reduce ( 0 , + ) , t+ 5 )
48
+ expectEqual ( mb. reduce ( Int . zero , + ) , t+ 5 )
51
49
let sb : Slice = mb [ ... ]
52
50
sb. withMemoryRebound ( to: ( UInt, UInt) . self) {
53
51
for i in $0. indices {
54
52
$0 [ i] . 1 -= 1
55
53
}
56
54
}
57
- expectEqual ( mb. reduce ( 0 , + ) , t)
55
+ expectEqual ( mb. reduce ( Int . zero , + ) , t)
58
56
return true
59
57
}
60
58
expectNotNil ( r)
@@ -89,14 +87,14 @@ UnsafeMutableBufferPointerSliceTests.test(
89
87
var ( it, ct) = mb. initialize ( from: ( 0 ..< c) . map ( String . init) )
90
88
expectNil ( it. next ( ) )
91
89
expectEqual ( ct, c)
92
- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c - 1 ) / 2 )
90
+ expectEqual ( mb. last . map ( Int . init) , c - 1 )
93
91
var rb = mb. deinitialize ( )
94
92
expectEqual ( rb. count, c*MemoryLayout< String> . stride)
95
93
96
94
( it, ct) = mb [ ... ] . initialize ( from: ( 0 ..< c) . map ( String . init) )
97
95
expectNil ( it. next ( ) )
98
96
expectEqual ( ct, c)
99
- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c - 1 ) / 2 )
97
+ expectEqual ( mb. last . map ( Int . init) , c - 1 )
100
98
rb = mb [ ... ] . deinitialize ( )
101
99
expectEqual ( rb. count, c*MemoryLayout< String> . stride)
102
100
}
@@ -110,13 +108,13 @@ UnsafeMutableBufferPointerSliceTests.test(
110
108
111
109
var ct = mb. initialize ( fromContentsOf: ( 1 ... c) . map ( String . init) )
112
110
expectEqual ( ct, c)
113
- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c + 1 ) / 2 )
111
+ expectEqual ( mb. last . map ( Int . init) , c )
114
112
var rb = mb. deinitialize ( )
115
113
expectEqual ( rb. count, c*MemoryLayout< String> . stride)
116
114
117
115
ct = mb [ ... ] . initialize ( fromContentsOf: ( 1 ... c) . map ( String . init) )
118
116
expectEqual ( ct, c)
119
- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c + 1 ) / 2 )
117
+ expectEqual ( mb. last . map ( Int . init) , c )
120
118
rb = mb [ ... ] . deinitialize ( )
121
119
expectEqual ( rb. count, c*MemoryLayout< String> . stride)
122
120
}
@@ -158,7 +156,7 @@ UnsafeMutableBufferPointerSliceTests.test(
158
156
$0. update ( fromContentsOf: ( 0 ..< c) . map ( String . init) )
159
157
}
160
158
expectEqual ( i, c)
161
- expectEqual ( a. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c - 1 ) / 2 )
159
+ expectEqual ( a. last . map ( Int . init) , c - 1 )
162
160
163
161
i = b. withContiguousMutableStorageIfAvailable {
164
162
$0 [ ... ] . update ( fromContentsOf: ( 0 ..< c) . map ( String . init) )
0 commit comments