@@ -3164,31 +3164,109 @@ SetTestSuite.test("∩") {
3164
3164
expectEqual ( Set < Int > ( ) , Set < Int > ( ) ∩ s1)
3165
3165
}
3166
3166
3167
- SetTestSuite . test ( " intersectInPlace " ) {
3168
- var s1 = Set ( [ 1010 , 2020 , 3030 ] )
3169
- let s2 = Set ( [ 4040 , 5050 , 6060 ] )
3170
- var s3 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] )
3171
- var s4 = Set ( [ 1010 , 2020 , 3030 ] )
3167
+ SetTestSuite . test ( " intersectInPlace.Native.Native " ) {
3168
+ var s1 = getCOWFastSet ( [ 1010 , 2020 , 3030 ] )
3169
+ let s2 = getCOWFastSet ( [ 4040 , 5050 , 6060 ] )
3170
+ var s3 = getCOWFastSet ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] )
3171
+ var s4 = getCOWFastSet ( [ 1010 , 2020 , 3030 ] )
3172
3172
3173
3173
let identity1 = unsafeBitCast ( s1, Int . self)
3174
3174
s1. intersectInPlace ( s4)
3175
3175
expectEqual ( s1, s4)
3176
3176
expectEqual ( identity1, unsafeBitCast ( s1, Int . self) )
3177
3177
3178
3178
s4. intersectInPlace ( s2)
3179
- expectEqual ( Set < Int > ( ) , s4)
3179
+ expectEqual ( getCOWFastSet ( [ ] ) , s4)
3180
3180
3181
3181
let identity2 = unsafeBitCast ( s3, Int . self)
3182
3182
s3. intersectInPlace ( s2)
3183
3183
expectEqual ( s3, s2)
3184
3184
expectTrue ( s1. isDisjointWith ( s3) )
3185
3185
expectNotEqual ( identity1, unsafeBitCast ( s3, Int . self) )
3186
3186
3187
- var s5 = Set < Int > ( )
3187
+ var s5 = getCOWFastSet ( [ ] )
3188
3188
s5. intersectInPlace ( s5)
3189
- expectEqual ( s5, Set < Int > ( ) )
3189
+ expectEqual ( s5, getCOWFastSet ( [ ] ) )
3190
3190
s5. intersectInPlace ( s1)
3191
- expectEqual ( s5, Set < Int > ( ) )
3191
+ expectEqual ( s5, getCOWFastSet ( [ ] ) )
3192
+ }
3193
+
3194
+ SetTestSuite . test ( " intersectInPlace.Native.BridgedVerbatim " ) {
3195
+ var s1 = getNativeBridgedVerbatimSet ( [ 1010 , 2020 , 3030 ] )
3196
+ var s3 = getNativeBridgedVerbatimSet ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] )
3197
+ var s4 = getNativeBridgedVerbatimSet ( [ 1010 , 2020 , 3030 ] )
3198
+
3199
+ let bvs2 = getBridgedVerbatimSet ( [ 4040 , 5050 , 6060 ] )
3200
+ var bvs4 = getBridgedVerbatimSet ( [ 1010 , 2020 , 3030 ] )
3201
+
3202
+ let identity1 = unsafeBitCast ( s1, Int . self)
3203
+ s1. intersectInPlace ( bvs4)
3204
+ expectEqual ( s1, bvs4)
3205
+ expectEqual ( identity1, unsafeBitCast ( s1, Int . self) )
3206
+
3207
+ s4. intersectInPlace ( bvs2)
3208
+ expectEqual ( Set < Int > ( ) , s4)
3209
+
3210
+ let identity2 = unsafeBitCast ( s3, Int . self)
3211
+ s3. intersectInPlace ( bvs2)
3212
+ expectEqual ( s3, bvs2)
3213
+ expectTrue ( s1. isDisjointWith ( s3) )
3214
+ expectNotEqual ( identity1, unsafeBitCast ( s3, Int . self) )
3215
+ }
3216
+
3217
+
3218
+ SetTestSuite . test ( " intersectInPlace.BridgedVerbatim.BridgedVerbatim " ) {
3219
+ var bvs1 = getBridgedVerbatimSet ( [ 1010 , 2020 , 3030 ] )
3220
+ let bvs2 = getBridgedVerbatimSet ( [ 4040 , 5050 , 6060 ] )
3221
+ var bvs3 = getBridgedVerbatimSet ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] )
3222
+ var bvs4 = getBridgedVerbatimSet ( [ 1010 , 2020 , 3030 ] )
3223
+
3224
+ let identity1 = unsafeBitCast ( bvs1, Int . self)
3225
+ bvs1. intersectInPlace ( bvs4)
3226
+ expectEqual ( bvs1, bvs4)
3227
+ expectEqual ( identity1, unsafeBitCast ( bvs1, Int . self) )
3228
+
3229
+ bvs4. intersectInPlace ( bvs2)
3230
+ expectEqual ( getBridgedVerbatimSet ( [ ] ) , bvs4)
3231
+
3232
+ let identity2 = unsafeBitCast ( bvs3, Int . self)
3233
+ bvs3. intersectInPlace ( bvs2)
3234
+ expectEqual ( bvs3, bvs2)
3235
+ expectTrue ( bvs1. isDisjointWith ( bvs3) )
3236
+ expectNotEqual ( identity1, unsafeBitCast ( bvs3, Int . self) )
3237
+
3238
+ var bvs5 = getBridgedVerbatimSet ( [ ] )
3239
+ bvs5. intersectInPlace ( bvs5)
3240
+ expectEqual ( bvs5, getBridgedVerbatimSet ( [ ] ) )
3241
+ bvs5. intersectInPlace ( bvs1)
3242
+ expectEqual ( bvs5, getBridgedVerbatimSet ( [ ] ) )
3243
+ }
3244
+
3245
+ SetTestSuite . test ( " intersectInPlace.BridgedNonverbatim.BridgedNonverbatim " ) {
3246
+ var bnvs1 = getBridgedNonverbatimSet ( [ 1010 , 2020 , 3030 ] )
3247
+ let bnvs2 = getBridgedNonverbatimSet ( [ 4040 , 5050 , 6060 ] )
3248
+ var bnvs3 = getBridgedNonverbatimSet ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] )
3249
+ var bnvs4 = getBridgedNonverbatimSet ( [ 1010 , 2020 , 3030 ] )
3250
+
3251
+ let identity1 = unsafeBitCast ( bnvs1, Int . self)
3252
+ bnvs1. intersectInPlace ( bnvs4)
3253
+ expectEqual ( bnvs1, bnvs4)
3254
+ expectEqual ( identity1, unsafeBitCast ( bnvs1, Int . self) )
3255
+
3256
+ bnvs4. intersectInPlace ( bnvs2)
3257
+ expectEqual ( getBridgedNonverbatimSet ( [ ] ) , bnvs4)
3258
+
3259
+ let identity2 = unsafeBitCast ( bnvs3, Int . self)
3260
+ bnvs3. intersectInPlace ( bnvs2)
3261
+ expectEqual ( bnvs3, bnvs2)
3262
+ expectTrue ( bnvs1. isDisjointWith ( bnvs3) )
3263
+ expectNotEqual ( identity1, unsafeBitCast ( bnvs3, Int . self) )
3264
+
3265
+ var bnvs5 = getBridgedNonverbatimSet ( [ ] )
3266
+ bnvs5. intersectInPlace ( bnvs5)
3267
+ expectEqual ( bnvs5, getBridgedNonverbatimSet ( [ ] ) )
3268
+ bnvs5. intersectInPlace ( bnvs1)
3269
+ expectEqual ( bnvs5, getBridgedNonverbatimSet ( [ ] ) )
3192
3270
}
3193
3271
3194
3272
SetTestSuite . test ( " ∩= " ) {
0 commit comments