Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Apr 23, 2022
1 parent 7a9e175 commit 950bf01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions test/DualTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dual_isapprox(a::Dual{T,T1,T2}, b::Dual{T3,T4,T5}) where {T,T1,T2,T3,T4,T5} = er
ForwardDiff.:(::Type{TestTag()}, ::Int) = true
ForwardDiff.:(::Int, ::Type{TestTag()}) = false

@testset "Dual{TestTag(),$V,$N} and Dual{TestTag(),Dual{TestTag(),$V,$M},$N}" for N in (0,3), M in (0,4), V in (Int, Float32)
@testset "Dual{Z,$V,$N} and Dual{Z,Dual{Z,$V,$M},$N}" for N in (0,3), M in (0,4), V in (Int, Float32)
println(" ...testing Dual{TestTag(),$V,$N} and Dual{TestTag(),Dual{TestTag(),$V,$M},$N}")

PARTIALS = Partials{N,V}(ntuple(n -> intrand(V), N))
Expand Down Expand Up @@ -218,9 +218,10 @@ ForwardDiff.:≺(::Int, ::Type{TestTag()}) = false
# M is the length of M_PARTIALS, which affects:
# NESTED_FDNUM = Dual{TestTag()}(Dual{TestTag()}(PRIMAL, M_PARTIALS), NESTED_PARTIALS)

@show N M
@show N M NESTED_FDNUM PRIMAL M_PARTIALS2 NESTED_PARTIALS2
@test isequal(NESTED_FDNUM, Dual{TestTag()}(Dual{TestTag()}(PRIMAL, M_PARTIALS2), NESTED_PARTIALS2)) == (N == M == 0)
@test isequal(NESTED_FDNUM, NESTED_FDNUM2) == isequal(PRIMAL, PRIMAL2) && (N == M == 0)
@show N M NESTED_FDNUM NESTED_FDNUM2 PRIMAL PRIMAL2
@test isequal(NESTED_FDNUM, NESTED_FDNUM2) == isequal(PRIMAL, PRIMAL2)

@test (FDNUM == Dual{TestTag()}(PRIMAL, PARTIALS2)) == (N == 0)
@test (PRIMAL == PRIMAL2) == (FDNUM == FDNUM2)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ForwardDiff, Test

@testset "ForwardDiff" begin
@testset "ForwardDiff.jl" begin
t0 = time()
@testset "Partials" begin
println("##### Testing Partials...")
Expand Down

0 comments on commit 950bf01

Please sign in to comment.