Skip to content

Commit 763e60b

Browse files
committed
add test for cache type
1 parent 592dc07 commit 763e60b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/forwarddiff_overloads.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ function static_h(p)
208208
(A, b)
209209
end
210210

211+
# Check to make sure it's not a DualLinearCache
212+
function static_linsolve_cache_check(p)
213+
A,b = static_h(p)
214+
prob = LinearProblem(A, b)
215+
cache = init(prob)
216+
cache isa LinearCache
217+
end
218+
219+
@test static_linsolve_cache_check([5.0, 5.0])
220+
211221
function static_linsolve(p)
212222
A, b = static_h(p)
213223
prob = LinearProblem(A, b)
@@ -220,4 +230,12 @@ function static_backslash(p)
220230
end
221231

222232
@test (ForwardDiff.jacobian(static_linsolve, [5.0, 5.0])
223-
ForwardDiff.jacobian(static_backslash, [5.0, 5.0]))
233+
ForwardDiff.jacobian(static_backslash, [5.0, 5.0]))
234+
235+
#Test to make sure that the cache is not a DualLinearCache
236+
A, b = static_h([ForwardDiff.Dual(5.0, 1.0, 0.0), ForwardDiff.Dual(5.0, 0.0, 1.0)])
237+
238+
static_dual_prob = LinearProblem(A, b)
239+
static_dual_cache = init(static_dual_prob)
240+
241+
@test static_dual_cache isa LinearSolve.LinearCache

0 commit comments

Comments
 (0)