1
+ // RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-distributed -parse-as-library)
2
+
3
+ // REQUIRES: executable_test
4
+ // REQUIRES: concurrency
5
+ // REQUIRES: distributed
6
+
7
+ // rdar://76038845
8
+ // UNSUPPORTED: use_os_stdlib
9
+ // UNSUPPORTED: back_deployment_runtime
10
+
11
+ import StdlibUnittest
12
+ import _Distributed
13
+
14
+ @available ( SwiftStdlib 5 . 5 , * )
15
+ struct ActorAddress : ActorIdentity , CustomStringConvertible {
16
+ let id : String
17
+ var description : Swift . String {
18
+ " ActorAddress(id: \( id) ) "
19
+ }
20
+ }
21
+
22
+ @main struct Main {
23
+ static func main( ) async {
24
+ if #available( SwiftStdlib 5 . 5 , * ) {
25
+
26
+ let ActorIdentityTests = TestSuite ( " ActorIdentity " )
27
+
28
+ ActorIdentityTests . test ( " equality " ) {
29
+ let a = ActorAddress ( id: " a " )
30
+ let b = ActorAddress ( id: " b " )
31
+
32
+ let anyA = AnyActorIdentity ( a)
33
+ let anyB = AnyActorIdentity ( b)
34
+
35
+ expectEqual ( a, a)
36
+ expectEqual ( anyA, anyA)
37
+
38
+ expectNotEqual ( a, b)
39
+ expectNotEqual ( anyA, anyB)
40
+ }
41
+
42
+ ActorIdentityTests . test ( " hash " ) {
43
+ let a = ActorAddress ( id: " a " )
44
+ let b = ActorAddress ( id: " b " )
45
+
46
+ let anyA = AnyActorIdentity ( a)
47
+ let anyB = AnyActorIdentity ( b)
48
+
49
+ expectEqual ( a. hashValue, a. hashValue)
50
+ expectEqual ( anyA. hashValue, anyA. hashValue)
51
+
52
+ expectNotEqual ( a. hashValue, b. hashValue)
53
+ expectNotEqual ( anyA. hashValue, anyB. hashValue)
54
+ }
55
+ }
56
+
57
+ await runAllTestsAsync ( )
58
+ }
59
+ }
0 commit comments