Skip to content

Commit ee36daa

Browse files
author
Pepijn de Vos
committed
add test
1 parent a39ef12 commit ee36daa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/tangent.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module tagent
22
using Diffractor
33
using Diffractor: AbstractZeroBundle, ZeroBundle, DNEBundle
44
using Diffractor: TaylorBundle, TaylorTangentIndex, CompositeBundle
5+
using Diffractor: ExplicitTangent, TaylorTangent, truncate
56
using ChainRulesCore
67
using Test
78

@@ -44,4 +45,12 @@ end
4445
@test f'(23.5) == Tangent{Foo152}(; x=1.0)
4546
end
4647

48+
@testset "truncate" begin
49+
tt = TaylorTangent((1.0,2.0,3.0,4.0,5.0,6.0,7.0))
50+
@test truncate(tt, Val(2)) == TaylorTangent((1.0,2.0))
51+
et = ExplicitTangent((1.0,2.0,3.0,4.0,5.0,6.0,7.0))
52+
@test truncate(et, Val(2)) == ExplicitTangent((1.0,2.0,3.0))
53+
@test truncate(et, Val(1)) == TaylorTangent((1.0,))
54+
end
55+
4756
end # module

0 commit comments

Comments
 (0)