Skip to content

Commit 32a6683

Browse files
test: add test to ensure remake retains properties of f passed to it
1 parent 2db6556 commit 32a6683

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/remake_tests.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,14 @@ end
372372
prob = ODEProblem(ODEFunction(foo; sys), [1.5, 2.5], (0.0, 1.0), [3.5, 4.5])
373373
@test_nowarn remake(prob; u0 = [:x => nothing], p = [:a => nothing])
374374
end
375+
376+
@testset "retain properties of `SciMLFunction` passed to `remake`" begin
377+
u0 = [1.0; 2.0; 3.0]
378+
p = [10.0, 20.0, 30.0]
379+
sys = SymbolCache([:x, :y, :z], [:a, :b, :c], :t)
380+
fn = NonlinearFunction(nllorenz!; sys, resid_prototype = zeros(Float64, 3))
381+
prob = NonlinearProblem(fn, u0, p)
382+
fn2 = NonlinearFunction(nllorenz!; resid_prototype = zeros(Float32, 3))
383+
prob2 = remake(prob; f = fn2)
384+
@test prob2.f.resid_prototype isa Vector{Float32}
385+
end

0 commit comments

Comments
 (0)