Skip to content

Commit

Permalink
add tests for float
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed Sep 18, 2015
1 parent e64e5d1 commit fb1193b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/test_gradients.jl
Expand Up @@ -65,6 +65,8 @@ for (test_partials, Grad) in ((test_partialstup, ForwardDiff.GradNumTup), (test_
@test convert(Grad{3,T}, 1) == Grad{3,T}(1.0)
@test convert(T, Grad{2,T}(1)) == 1.0

@test float(int_grad) == float_grad

@test promote_type(Grad{N,Int}, Grad{N,Int}) == Grad{N,Int}
@test promote_type(Grad{N,Float64}, Grad{N,Int}) == Grad{N,Float64}
@test promote_type(Grad{N,Int}, Float64) == Grad{N,Float64}
Expand Down
2 changes: 2 additions & 0 deletions test/test_hessians.jl
Expand Up @@ -77,6 +77,8 @@ const_hess = HessianNumber{N,T,C}(float_val)
@test convert(HessianNumber{3,T,NTuple{3,T}}, 1) == HessianNumber{3,T,NTuple{3,T}}(1.0)
@test convert(T, HessianNumber(GradientNumber(1, tuple(0, 0)))) == 1.0

@test float(int_hess) == float_hess

IntHess = HessianNumber{N,Int,NTuple{N,Int}}
FloatHess = HessianNumber{N,Float64,NTuple{N,Float64}}

Expand Down
2 changes: 2 additions & 0 deletions test/test_tensors.jl
Expand Up @@ -91,6 +91,8 @@ const_tens = TensorNumber{N,T,C}(float_val)
@test convert(TensorNumber{3,T,NTuple{3,T}}, 1) == TensorNumber{3,T,NTuple{3,T}}(1.0)
@test convert(T, TensorNumber(HessianNumber(GradientNumber(1, tuple(0, 0))))) == 1.0

@test float(int_tens) == float_tens

IntTens = TensorNumber{N,Int,NTuple{N,Int}}
FloatTens = TensorNumber{N,Float64,NTuple{N,Float64}}

Expand Down

0 comments on commit fb1193b

Please sign in to comment.