Skip to content

Commit

Permalink
add some more test cases to zero_tangent
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Oct 4, 2023
1 parent 7e7b441 commit b9e3376
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/tangent_types/abstract_zero.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,17 @@ end
mutable struct MutDemo
x::Float64
end
struct Demo
x::Float64
end
@test zero_tangent(MutDemo(1.5)) isa MutableTangent{MutDemo}
@test iszero(zero_tangent(MutDemo(1.5)))

@test zero_tangent((; a=1)) isa ZeroTangent
@test zero_tangent(Demo(1.2)) isa ZeroTangent

@test zero_tangent(1) === 0
@test zero_tangent(1.0) === 0.0

@test zero_tangent([1.0, 2.0]) == [0.0, 0.0]
@test zero_tangent([[1.0, 2.0], [3.0]]) == [[0.0, 0.0], [0.0]]
Expand Down

0 comments on commit b9e3376

Please sign in to comment.