Skip to content

Commit 14864f3

Browse files
committed
test
1 parent bb72f52 commit 14864f3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/basic.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ sinexpbc(x) = sinexp.(x)
5656
@test @jit(sinexpbc(a)) r_res
5757
end
5858

59+
function throw_if_within_autodiff()
60+
if Enzyme.within_autodiff()
61+
error("`within_autodiff` returned true even though we are not in an autodiff call.")
62+
end
63+
return nothing
64+
end
65+
@testset "within_autodiff" begin
66+
@test isnothing(@jit throw_if_within_autodiff())
67+
end
68+
5969
sumexp(x) = sum(exp, x)
6070

6171
sum_compare(x) = sum(x) > 0

0 commit comments

Comments
 (0)