Skip to content

Commit c90fc69

Browse files
committed
Add corner case tests
1 parent c11dd72 commit c90fc69

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/primitive.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,25 @@ end
4747
@test derivative(f, 0, order)fdm(f, 0) atol=1e-6
4848
end
4949
end
50+
51+
@testset "Corner cases" begin
52+
offenders = (
53+
TaylorDiff.TaylorScalar{Float64, 4}((Inf, 1.0, 0.0, 0.0)),
54+
TaylorDiff.TaylorScalar{Float64, 4}((Inf, 0.0, 0.0, 0.0)),
55+
TaylorDiff.TaylorScalar{Float64, 4}((1.0, 0.0, 0.0, 0.0)),
56+
TaylorDiff.TaylorScalar{Float64, 4}((1.0, Inf, 0.0, 0.0)),
57+
TaylorDiff.TaylorScalar{Float64, 4}((0.0, 1.0, 0.0, 0.0)),
58+
TaylorDiff.TaylorScalar{Float64, 4}((0.0, Inf, 0.0, 0.0)) # Others ?
59+
)
60+
f_id = (
61+
:id => x -> x,
62+
:add0 => x -> x + 0,
63+
:sub0 => x -> x - 0,
64+
:mul1 => x -> x * 1,
65+
:div1 => x -> x / 1,
66+
:pow1 => x -> x^1
67+
)
68+
for (name, f) in f_id, t in offenders
69+
@test f(t) == t
70+
end
71+
end

0 commit comments

Comments
 (0)