@@ -29,6 +29,34 @@ class TestPersonNameComponents : TestPersonNameComponentsSuper {
29
29
result. familyName = familyName
30
30
return result
31
31
}
32
+
33
+ func test_Hashing( ) {
34
+ guard #available( macOS 10 . 11 , iOS 9 . 0 , * ) else { return }
35
+
36
+ let values : [ [ PersonNameComponents ] ] = [
37
+ [
38
+ makePersonNameComponents ( givenName: " Kevin " , familyName: " Frank " ) ,
39
+ makePersonNameComponents ( givenName: " Kevin " , familyName: " Frank " ) ,
40
+ ] ,
41
+ [
42
+ makePersonNameComponents ( givenName: " John " , familyName: " Frank " ) ,
43
+ makePersonNameComponents ( givenName: " John " , familyName: " Frank " ) ,
44
+ ] ,
45
+ [
46
+ makePersonNameComponents ( givenName: " Kevin " , familyName: " Appleseed " ) ,
47
+ makePersonNameComponents ( givenName: " Kevin " , familyName: " Appleseed " ) ,
48
+ ] ,
49
+ [
50
+ makePersonNameComponents ( givenName: " John " , familyName: " Appleseed " ) ,
51
+ makePersonNameComponents ( givenName: " John " , familyName: " Appleseed " ) ,
52
+ ]
53
+ ]
54
+ checkHashableGroups (
55
+ values,
56
+ // FIXME: PersonNameComponents hashes aren't seeded.
57
+ allowIncompleteHashing: true )
58
+ }
59
+
32
60
func test_AnyHashableContainingPersonNameComponents( ) {
33
61
if #available( OSX 10 . 11 , iOS 9 . 0 , * ) {
34
62
let values : [ PersonNameComponents ] = [
@@ -72,6 +100,7 @@ class TestPersonNameComponents : TestPersonNameComponentsSuper {
72
100
73
101
#if !FOUNDATION_XCTEST
74
102
var PersonNameComponentsTests = TestSuite ( " TestPersonNameComponents " )
103
+ PersonNameComponentsTests . test ( " test_Hashing " ) { TestPersonNameComponents ( ) . test_Hashing ( ) }
75
104
PersonNameComponentsTests . test ( " test_AnyHashableContainingPersonNameComponents " ) { TestPersonNameComponents ( ) . test_AnyHashableContainingPersonNameComponents ( ) }
76
105
PersonNameComponentsTests . test ( " test_AnyHashableCreatedFromNSPersonNameComponents " ) { TestPersonNameComponents ( ) . test_AnyHashableCreatedFromNSPersonNameComponents ( ) }
77
106
runAllTests ( )
0 commit comments