@@ -47,14 +47,14 @@ UnsafeMutableBufferPointerSliceTests.test(
4747 $0 [ i] . 0 += 1
4848 }
4949 }
50- expectEqual ( mb. reduce ( 0 , + ) , t+ 5 )
50+ expectEqual ( mb. reduce ( Int . zero , + ) , t+ 5 )
5151 let sb : Slice = mb [ ... ]
5252 sb. withMemoryRebound ( to: ( UInt, UInt) . self) {
5353 for i in $0. indices {
5454 $0 [ i] . 1 -= 1
5555 }
5656 }
57- expectEqual ( mb. reduce ( 0 , + ) , t)
57+ expectEqual ( mb. reduce ( Int . zero , + ) , t)
5858 return true
5959 }
6060 expectNotNil ( r)
@@ -89,14 +89,14 @@ UnsafeMutableBufferPointerSliceTests.test(
8989 var ( it, ct) = mb. initialize ( from: ( 0 ..< c) . map ( String . init) )
9090 expectNil ( it. next ( ) )
9191 expectEqual ( ct, c)
92- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c - 1 ) / 2 )
92+ expectEqual ( mb. last . map ( Int . init) , c - 1 )
9393 var rb = mb. deinitialize ( )
9494 expectEqual ( rb. count, c*MemoryLayout< String> . stride)
9595
9696 ( it, ct) = mb [ ... ] . initialize ( from: ( 0 ..< c) . map ( String . init) )
9797 expectNil ( it. next ( ) )
9898 expectEqual ( ct, c)
99- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c - 1 ) / 2 )
99+ expectEqual ( mb. last . map ( Int . init) , c - 1 )
100100 rb = mb [ ... ] . deinitialize ( )
101101 expectEqual ( rb. count, c*MemoryLayout< String> . stride)
102102}
@@ -110,13 +110,13 @@ UnsafeMutableBufferPointerSliceTests.test(
110110
111111 var ct = mb. initialize ( fromContentsOf: ( 1 ... c) . map ( String . init) )
112112 expectEqual ( ct, c)
113- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c + 1 ) / 2 )
113+ expectEqual ( mb. last . map ( Int . init) , c )
114114 var rb = mb. deinitialize ( )
115115 expectEqual ( rb. count, c*MemoryLayout< String> . stride)
116116
117117 ct = mb [ ... ] . initialize ( fromContentsOf: ( 1 ... c) . map ( String . init) )
118118 expectEqual ( ct, c)
119- expectEqual ( mb. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c + 1 ) / 2 )
119+ expectEqual ( mb. last . map ( Int . init) , c )
120120 rb = mb [ ... ] . deinitialize ( )
121121 expectEqual ( rb. count, c*MemoryLayout< String> . stride)
122122}
@@ -158,7 +158,7 @@ UnsafeMutableBufferPointerSliceTests.test(
158158 $0. update ( fromContentsOf: ( 0 ..< c) . map ( String . init) )
159159 }
160160 expectEqual ( i, c)
161- expectEqual ( a. compactMap ( Int . init) . reduce ( 0 , + ) , c* ( c - 1 ) / 2 )
161+ expectEqual ( a. last . map ( Int . init) , c - 1 )
162162
163163 i = b. withContiguousMutableStorageIfAvailable {
164164 $0 [ ... ] . update ( fromContentsOf: ( 0 ..< c) . map ( String . init) )
0 commit comments