@@ -71,20 +71,19 @@ using FiniteDifferences: rand_tangent
7171 Hermitian (randn (ComplexF64, 1 , 1 )),
7272 Tangent{Hermitian{ComplexF64, Matrix{ComplexF64}}},
7373 ),
74- (
75- Adjoint (randn (ComplexF64, 3 , 3 )),
76- Tangent{Adjoint{ComplexF64, Matrix{ComplexF64}}},
77- ),
78- (
79- Transpose (randn (3 )),
80- Tangent{Transpose{Float64, Vector{Float64}}},
81- ),
8274 ]
8375 @test rand_tangent (rng, x) isa T_tangent
8476 @test rand_tangent (x) isa T_tangent
85- @test x + rand_tangent (rng, x) isa typeof (x)
8677 end
8778
88- # Ensure struct fallback errors for non-struct types.
89- @test_throws ArgumentError invoke (rand_tangent, Tuple{AbstractRNG, Any}, rng, 5.0 )
79+ @testset " erroring cases" begin
80+ # Ensure struct fallback errors for non-struct types.
81+ @test_throws ArgumentError invoke (rand_tangent, Tuple{AbstractRNG, Any}, rng, 5.0 )
82+ end
83+
84+ @testset " compsition of addition" begin
85+ x = Foo (1.5 , 2 , Foo (1.1 , 3 , [1.7 , 1.4 , 0.9 ]))
86+ @test x + rand_tangent (x) isa typeof (x)
87+ @test x + (rand_tangent (x) + rand_tangent (x)) isa typeof (x)
88+ end
9089end
0 commit comments