@@ -24,7 +24,16 @@ function test_approx(
24
24
@test_msg msg isapprox (actual, expected; kwargs... )
25
25
end
26
26
27
- for (T1, T2) in ((AbstractThunk, Any), (AbstractThunk, AbstractThunk), (Any, AbstractThunk))
27
+ for (T1, T2) in
28
+ (
29
+ (AbstractThunk, Any),
30
+ (AbstractThunk, AbstractThunk),
31
+ (Any, AbstractThunk),
32
+ (Tangent, AbstractThunk),
33
+ (AbstractThunk, Tangent),
34
+ (AbstractZero, AbstractThunk),
35
+ (AbstractThunk, AbstractZero),
36
+ )
28
37
@eval function test_approx (actual:: $T1 , expected:: $T2 , msg= " " ; kwargs... )
29
38
return test_approx (unthunk (actual), unthunk (expected), msg; kwargs... )
30
39
end
@@ -123,9 +132,8 @@ function test_approx(actual::Tangent{P,T}, expected, msg=""; kwargs...) where {T
123
132
end
124
133
test_approx (x, y:: Tangent , msg= " " ; kwargs... ) = test_approx (y, x, msg; kwargs... )
125
134
126
- function test_approx (actual:: Tangent , expected:: AbstractThunk , msg= " " ; kwargs... )
127
- return test_approx (actual, unthunk (expected), msg; kwargs... )
128
- end
135
+ test_approx (z:: NoTangent , t:: Tangent , msg= " " ; kwargs... ) = all (== (NoTangent ()), t)
136
+ test_approx (t:: Tangent , z:: NoTangent , msg= " " ; kwargs... ) = all (== (NoTangent ()), t)
129
137
130
138
# This catches comparisons of Tangents and Tuples/NamedTuple
131
139
# and gives an error message complaining about that. the `@test` will definitely fail
0 commit comments