File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Tests/OpenGraphCompatibilityTests/Runtime Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,8 @@ struct UnsafeMutableTupleCompatibilityTests {
151151 }
152152
153153 @Test
154- func buffer( ) {
154+ func stackBuffer( ) {
155+ // size <= 0x1000
155156 withUnsafeTuple ( of: TupleType ( [ T1 . self, T2 . self] ) , count: 1 ) { mutableTuple in
156157 let ref = T1 ( )
157158 ref. a = 1
@@ -162,6 +163,26 @@ struct UnsafeMutableTupleCompatibilityTests {
162163 let t1 = tuple [ 0 ] as T1
163164 let t2 = tuple [ 1 ] as T2
164165
166+ #expect( t1 === ref)
167+ #expect( t1. a == 1 )
168+ #expect( t2. a == 2 )
169+ }
170+
171+ }
172+
173+ @Test
174+ func heapBuffer( ) {
175+ // size > 0x1000
176+ withUnsafeTuple ( of: TupleType ( [ T1 . self, T2 . self] ) , count: 512 ) { mutableTuple in
177+ let ref = T1 ( )
178+ ref. a = 1
179+ mutableTuple. initialize ( at: 0 , to: ref)
180+ mutableTuple. initialize ( at: 1 , to: T2 ( a: 2 ) )
181+
182+ let tuple = UnsafeTuple ( type: mutableTuple. type, value: mutableTuple. value)
183+ let t1 = tuple [ 0 ] as T1
184+ let t2 = tuple [ 1 ] as T2
185+
165186 #expect( t1 === ref)
166187 #expect( t1. a == 1 )
167188 #expect( t2. a == 2 )
You can’t perform that action at this time.
0 commit comments