Skip to content

Commit cb17c75

Browse files
committed
update from main
1 parent 7a8ce1c commit cb17c75

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/tests.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ end
520520

521521
@testset "Simple Exception" begin
522522
f_simple_exc(x, i) = x[i]
523+
y = [1.0, 2.0]
523524
f_x = zero.(y)
524525
@test_throws BoundsError autodiff(Reverse, f_simple_exc, Duplicated(y, f_x), Const(0))
525526
end
@@ -1570,7 +1571,12 @@ end
15701571
end
15711572

15721573
@testset "Vector to Number" for f in DiffTests.VECTOR_TO_NUMBER_FUNCS
1573-
test_matrix_to_number(f, y; rtol=1e-6, atol=1e-6)
1574+
# `test_matrix_to_number` contains a `@generated` function, we wrap it in a
1575+
# `Ref{Any}` container only to be able to catch and test the warnings emitted during
1576+
# compilation in the body of the function.
1577+
test_mat2num = Ref{Any}(test_matrix_to_number)
1578+
warn_msg = f === DiffTests.vec2num_3 ? r"Using fallback BLAS replacements for" : ""
1579+
@test_warn warn_msg test_mat2num[](f, y; rtol = 1.0e-6, atol = 1.0e-6)
15741580
end
15751581

15761582
@testset "Matrix to Number" for f in DiffTests.MATRIX_TO_NUMBER_FUNCS
@@ -3326,7 +3332,7 @@ function uns_sum2(x::Array{T})::T where T
33263332
return v
33273333
end
33283334

3329-
function uns_ad_forward(scale_diag::Vector{T}, c) where T
3335+
function uns_ad_forward(scale_diag::Vector{T}, c) where T
33303336
res = uns_mymean(uns_sum2, [scale_diag,], T, c)
33313337
return res
33323338
end

0 commit comments

Comments
 (0)