@@ -33,7 +33,7 @@ struct OCIPlatformTests {
3333
3434 @Test func differentOS( ) {
3535 let lhs = Platform ( arch: " arm64 " , os: " linux " )
36- let rhs = Platform ( arch: " arm64 " , os: " darwin " )
36+ let rhs = Platform ( arch: " arm64 " , os: " windows " )
3737 #expect( lhs != rhs, " Different OS should not be equal " )
3838 }
3939
@@ -81,4 +81,38 @@ struct OCIPlatformTests {
8181 set. insert ( withoutVariant)
8282 #expect( set. contains ( withV8) , " arm64/v8 must be found in a Set that contains arm64 with nil variant " )
8383 }
84+
85+ @Test func arm64_differentOS_nilAndV8( ) {
86+ let linux = Platform ( arch: " arm64 " , os: " linux " , variant: nil )
87+ let windows = Platform ( arch: " arm64 " , os: " windows " , variant: " v8 " )
88+ #expect( linux != windows, " The arm64 nil/v8 variant rule must not ignore a differing OS " )
89+ #expect( windows != linux, " The arm64 nil/v8 variant rule must not ignore a differing OS " )
90+ }
91+
92+ @Test func arm64_differentOS_bothV8( ) {
93+ let linux = Platform ( arch: " arm64 " , os: " linux " , variant: " v8 " )
94+ let windows = Platform ( arch: " arm64 " , os: " windows " , variant: " v8 " )
95+ #expect( linux != windows, " Same arch and variant but different OS => not equal " )
96+ }
97+
98+ @Test func arm64_normalizedArchDifferentOS( ) {
99+ // aarch64 normalizes to arm64, so both sides hit the arm64 variant rule.
100+ let linux = Platform ( arch: " aarch64 " , os: " linux " , variant: nil )
101+ let windows = Platform ( arch: " arm64 " , os: " windows " , variant: " v8 " )
102+ #expect( linux != windows, " Normalized arm64 platforms with a differing OS => not equal " )
103+ }
104+
105+ @Test func arm64_differentOS_setLookup( ) {
106+ let linux = Platform ( arch: " arm64 " , os: " linux " , variant: nil )
107+ let windows = Platform ( arch: " arm64 " , os: " windows " , variant: " v8 " )
108+ var set = Set < Platform > ( )
109+ set. insert ( linux)
110+ #expect( !set. contains ( windows) , " windows/arm64/v8 must not be found in a Set holding linux/arm64 " )
111+ }
112+
113+ @Test func arm64_platformMatcherDifferentOS( ) {
114+ let matcher = createPlatformMatcher ( for: Platform ( arch: " arm64 " , os: " linux " , variant: nil ) )
115+ #expect( !matcher( Platform ( arch: " arm64 " , os: " windows " , variant: " v8 " ) ) , " matcher must reject a differing OS " )
116+ #expect( matcher ( Platform ( arch: " arm64 " , os: " linux " , variant: " v8 " ) ) , " matcher must accept the same OS with an implied v8 variant " )
117+ }
84118}
0 commit comments