@@ -25,6 +25,7 @@ class TestNSSet : XCTestCase {
25
25
( " test_CountedSetRemoveObject " , test_CountedSetRemoveObject) ,
26
26
( " test_CountedSetCopying " , test_CountedSetCopying) ,
27
27
( " test_mutablesetWithDictionary " , test_mutablesetWithDictionary) ,
28
+ ( " test_Subsets " , test_Subsets)
28
29
]
29
30
}
30
31
@@ -224,4 +225,16 @@ class TestNSSet : XCTestCase {
224
225
dictionary. setObject ( aSet, forKey: key)
225
226
XCTAssertNotNil ( dictionary. description) //should not crash
226
227
}
228
+
229
+ func test_Subsets( ) {
230
+ let set = NSSet ( array: [ " foo " , " bar " , " baz " ] )
231
+ let otherSet = NSSet ( array: [ " foo " , " bar " ] )
232
+ let otherOtherSet = Set < AnyHashable > ( [ " foo " , " bar " , " baz " , " 123 " ] )
233
+ let newSet = Set < AnyHashable > ( [ " foo " , " bin " ] )
234
+ XCTAssert ( otherSet. isSubset ( of: set as! Set < AnyHashable > ) )
235
+ XCTAssertFalse ( set. isSubset ( of: otherSet as! Set < AnyHashable > ) )
236
+ XCTAssert ( set. isSubset ( of: otherOtherSet) )
237
+ XCTAssert ( otherSet. isSubset ( of: otherOtherSet) )
238
+ XCTAssertFalse ( newSet. isSubset ( of: otherSet as! Set < AnyHashable > ) )
239
+ }
227
240
}
0 commit comments