Skip to content

Commit 29004df

Browse files
committed
Add more gradient tests
1 parent 8d91124 commit 29004df

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

test/StdTest.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ end
345345
@test to_std_string(gradient(sum(x), x)) == "vec(1)"
346346
@test to_std_string(gradient(2 * sum(x), x)) == "2vec(1)"
347347
@test to_std_string(gradient(sum(2 * x), x)) == "2vec(1)"
348+
@test to_std_string(gradient(2 * sum(sin(x)), x)) == "2cos(x)"
349+
@test to_std_string(gradient(sum(2 * sin(x)), x)) == "2cos(x)"
350+
@test to_std_string(gradient(2 * sum(cos(A * x + y)), x)) == "2(-1)Aᵀsin(Ax + y)"
351+
@test to_std_string(gradient(sum(2 * cos(A * x + y)), x)) == "2(-1)Aᵀsin(Ax + y)"
348352
@test to_std_string(gradient(sum(x .^ 2), x)) == "2x"
349353
@test to_std_string(gradient(sum(x .^ 3), x)) == "3x²"
350354
@test to_std_string(gradient(sum((x + y) .^ 2), x)) == "2(x + y)"

0 commit comments

Comments
 (0)