@@ -499,16 +499,20 @@ ${SelfName}TestSuite.test("withMemoryReboundSE0333") {
499
499
}
500
500
501
501
${SelfName}TestSuite.test("withMemoryReboundSE0333.capacity1") {
502
- let mutablePtr = UnsafeMutablePointer<(Int,Bool,UInt8)>.allocate(capacity: 1)
502
+ let mutablePtr = UnsafeMutablePointer<(Int,Bool,Int64)>.allocate(capacity: 1)
503
+ let i = Int.random(in: 0 ... .max)
504
+ mutablePtr.initialize(to: (i, i.isMultiple(of: 2), Int64(0xff & i)))
503
505
defer { mutablePtr.deallocate() }
504
- let ptr = ${SelfName}<(Int, Bool, UInt8 )>(mutablePtr)
506
+ let ptr = ${SelfName}<(Int, Bool, Int64 )>(mutablePtr)
505
507
// test rebinding to a shorter type with the same alignment
506
508
ptr.withMemoryRebound(to: (Int, Bool).self, capacity: 1) {
507
509
// Make sure the closure argument is a ${SelfName}
508
510
let ptrT: ${SelfName}<(Int, Bool)> = $0
509
511
// and that the element is (Int, Bool).
510
512
let mutablePtrT = UnsafeMutablePointer(mutating: ptrT)
511
513
expectType((Int, Bool).self, &mutablePtrT.pointee)
514
+ expectEqual($0.pointee.0, i)
515
+ expectEqual($0.pointee.1, i.isMultiple(of: 2))
512
516
}
513
517
}
514
518
0 commit comments