Skip to content

Commit

Permalink
Test 'PointerToMutable.unsafe_pointee()'
Browse files Browse the repository at this point in the history
  • Loading branch information
kyouko-taiga committed Sep 19, 2023
1 parent df31d8f commit ba653b2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tests/LibraryTests/TestCases/PointerToMutableTests.hylo
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ fun test_advance() {
precondition(!(f == e))
}

fun test_pointee() {
let p = PointerToMutable<Int>.allocate(count: 1)
p.unsafe_initialize_pointee(fun (_ i: set Int) -> Void { &i = 42 })
let y = p.unsafe_pointee()
precondition(42 == y)
p.deallocate()
}

public fun main() {
test_advance_by_bytes()
test_advance()
test_pointee()
}

0 comments on commit ba653b2

Please sign in to comment.