Skip to content

Commit

Permalink
adding a few tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leios committed Nov 2, 2023
1 parent d65431e commit 5b84ae6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function __kernel(expr, generate_cpu=true, force_inbounds=false)
@inbounds $(def[:body])
end
def[:body] = body_qt
println(def[:body])
end

find_return(expr) && error("Return statement not permitted in a kernel function $name")
Expand Down
12 changes: 12 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ kern_static(CPU(static=true), (1,))(A, ndrange=length(A))
end
@test_throws ErrorException("This kernel is unavailable for backend CPU") my_no_cpu_kernel(CPU())

# testing multiple configurations at the same time
@kernel cpu=false inbounds=false my_no_cpu_kernel2(a)
end
@test_throws ErrorException("This kernel is unavailable for backend CPU") my_no_cpu_kernel2(CPU())

# testing bounds errors
@kernel inbounds=false my_bounded_kernel(a) = a[1]
@test_throws BoundsError(Int64[],(1,)) my_bounded_kernel(CPU())(Int[], ndrange=1)

@kernel inbounds=true my_inbounds_kernel(a) = a[1]
@test nothing == my_inbounds_kernel(CPU())(Int[], ndrange=1)

struct NewBackend <: KernelAbstractions.GPU end
@testset "Default host implementation" begin
backend = NewBackend()
Expand Down

0 comments on commit 5b84ae6

Please sign in to comment.