Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed Apr 27, 2017
1 parent 19603aa commit bfd3dd7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/GradientTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for c in (1, 2, 3), tag in (nothing, f)
println(" ...running hardcoded test with chunk size = $c and tag = $tag")
cfg = ForwardDiff.GradientConfig(tag, x, ForwardDiff.Chunk{c}())

@test eltype(cfg) == Dual{Tag(typeof(tag), eltype(x)), eltype(x), c}
@test eltype(cfg) == Dual{typeof(Tag(typeof(tag), eltype(x))), eltype(x), c}

@test isapprox(g, ForwardDiff.gradient(f, x, cfg))
@test isapprox(g, ForwardDiff.gradient(f, x))
Expand Down
4 changes: 2 additions & 2 deletions test/HessianTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ for c in (1, 2, 3), tag in (nothing, f)
cfg = ForwardDiff.HessianConfig(tag, x, ForwardDiff.Chunk{c}())
resultcfg = ForwardDiff.HessianConfig(tag, DiffBase.HessianResult(x), x, ForwardDiff.Chunk{c}())

D = Dual{Tag(typeof(tag), eltype(x)), eltype(x), c}
@test eltype(cfg) == Dual{Tag(typeof(tag), D), D, c}
D = Dual{typeof(Tag(Void, eltype(x))), eltype(x), c}
@test eltype(cfg) == Dual{typeof(Tag(typeof(tag), Dual{Void,eltype(x),0})), D, c}
@test eltype(resultcfg) == eltype(cfg)

@test isapprox(h, ForwardDiff.hessian(f, x))
Expand Down
4 changes: 2 additions & 2 deletions test/JacobianTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ for c in (1, 2, 3), tags in ((nothing, nothing), (f, f!))
cfg = JacobianConfig(tags[1], x, ForwardDiff.Chunk{c}())
ycfg = JacobianConfig(tags[2], zeros(4), x, ForwardDiff.Chunk{c}())

@test eltype(cfg) == Dual{Tag(typeof(tags[1]), eltype(x)), eltype(x), c}
@test eltype(ycfg) == Dual{Tag(typeof(tags[2]), eltype(x)), eltype(x), c}
@test eltype(cfg) == Dual{typeof(Tag(typeof(tags[1]), eltype(x))), eltype(x), c}
@test eltype(ycfg) == Dual{typeof(Tag(typeof(tags[2]), eltype(x))), eltype(x), c}

# testing f(x)
@test isapprox(j, ForwardDiff.jacobian(f, x, cfg))
Expand Down

0 comments on commit bfd3dd7

Please sign in to comment.