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