Skip to content

Commit

Permalink
More tests for pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt authored and maleadt committed May 25, 2020
1 parent 13a7906 commit cdf418a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/pointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ voidptr_b = CuPtr{Cvoid}(Int(0xCAFEBABE))
intptr_a = CuPtr{Int}(Int(0xDEADBEEF))
@test convert(typeof(intptr_a), voidptr_a) == intptr_a

# convert back and forth from UInt
intptr_b = CuPtr{Int}(Int(0xDEADBEEF))
@test convert(UInt, intptr_b) == 0xDEADBEEF
@test convert(CuPtr{Int}, Int(0xDEADBEEF)) == intptr_b
@test Int(intptr_b) == Int(0xDEADBEEF)

# pointer arithmetic
intptr_c = CuPtr{Int}(Int(0xDEADBEEF))
intptr_d = 2 + intptr_c
@test isless(intptr_c, intptr_d)
@test intptr_d - intptr_c == 2
@test intptr_d - 2 == intptr_c
end


Expand Down

0 comments on commit cdf418a

Please sign in to comment.