Skip to content

Commit 9dabe45

Browse files
authored
Add a few tests
1 parent 097fc6a commit 9dabe45

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/forwarddiff_dual_detection.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,13 @@ end
379379
ReverseDiff.TrackedReal{<:ForwardDiff.Dual}
380380
@test DiffEqBase.promote_u0(NaN, [NaN], 0.0) isa Float64
381381
@test DiffEqBase.promote_u0([1.0], [NaN], 0.0) isa Vector{Float64}
382+
383+
# totallength
384+
val = rand(10)
385+
par = rand(10)
386+
u = Dual.(val, par)
387+
@test DiffEqBase.totallength(val[1]) == 1
388+
@test DiffEqBase.totallength(val) == length(val)
389+
@test DiffEqBase.totallength(par) == length(par)
390+
@test DiffEqBase.totallength(u[1]) == DiffEqBase.totallength(val[1]) + DiffEqBase.totallength(par[1])
391+
@test DiffEqBase.totallength(u) == sum(DiffEqBase.totallength, u)

0 commit comments

Comments
 (0)