22//
33// This source file is part of the Swift Collections open source project
44//
5- // Copyright (c) 2021 - 2024 Apple Inc. and the Swift project authors
5+ // Copyright (c) 2021 - 2025 Apple Inc. and the Swift project authors
66// Licensed under Apache License v2.0 with Runtime Library Exception
77//
88// See https://swift.org/LICENSE.txt for license information
@@ -242,16 +242,12 @@ final class BitSetTest: CollectionTestCase {
242242 var expected : Set < Int > = [ ]
243243 let input = ( 0 ..< count) . shuffled ( using: & rng)
244244 withEvery ( " i " , in: input. indices) { i in
245- let ( i1, m1) = actual. insert ( input [ i] )
246- expected. insert ( input [ i] )
247- expectTrue ( i1)
248- expectEqual ( m1, input [ i] )
245+ let v = input [ i]
246+ expectTrue ( actual. insert ( v) == expected. insert ( v) )
249247 if i % 25 == 0 {
250248 expectEqual ( Array ( actual) , expected. sorted ( ) )
251249 }
252- let ( i2, m2) = actual. insert ( input [ i] )
253- expectFalse ( i2)
254- expectEqual ( m2, m1)
250+ expectTrue ( actual. insert ( v) == expected. insert ( v) )
255251 }
256252 expectEqual ( Array ( actual) , expected. sorted ( ) )
257253 }
@@ -265,13 +261,12 @@ final class BitSetTest: CollectionTestCase {
265261 var expected : Set < Int > = [ ]
266262 let input = ( 0 ..< count) . shuffled ( using: & rng)
267263 withEvery ( " i " , in: input. indices) { i in
268- let old = actual. update ( with: input [ i] )
269- expected. update ( with: input [ i] )
270- expectEqual ( old, input [ i] )
264+ let v = input [ i]
265+ expectEqual ( actual. update ( with: v) , expected. update ( with: v) )
271266 if i % 25 == 0 {
272267 expectEqual ( Array ( actual) , expected. sorted ( ) )
273268 }
274- expectNil ( actual. update ( with: input [ i ] ) )
269+ expectEqual ( actual. update ( with: v ) , expected . update ( with : v ) )
275270 }
276271 expectEqual ( Array ( actual) , expected. sorted ( ) )
277272 }
@@ -289,13 +284,11 @@ final class BitSetTest: CollectionTestCase {
289284
290285 withEvery ( " i " , in: input. indices) { i in
291286 let v = input [ i]
292- let old = actual. remove ( v)
293- expected. remove ( v)
294- expectEqual ( old, v)
287+ expectEqual ( actual. remove ( v) , expected. remove ( v) )
295288 if i % 25 == 0 {
296289 expectEqual ( Array ( actual) , expected. sorted ( ) )
297290 }
298- expectNil ( actual. remove ( v) )
291+ expectEqual ( actual. remove ( v ) , expected . remove ( v) )
299292 }
300293 expectEqual ( Array ( actual) , expected. sorted ( ) )
301294 }
0 commit comments