Skip to content

Commit

Permalink
Merge c12443f into 63fe051
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Sep 2, 2019
2 parents 63fe051 + c12443f commit 0d234c6
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions test/rulesets/Base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,8 @@
rrule_test(identity, randn(rng, 4), (randn(rng, 4), randn(rng, 4)))
end

@testset "Constants" begin
function test_constant(f, x, expected)
y, rule = frule(f, x)
@test y == expected
@test extern(rule(1)) == 0.0

y, rule = rrule(f, x)
@test y == expected
@test extern(rule(1)) == 0.0
end
test_constant(one, 5, 1)
test_constant(one, -4.1, 1)

test_constant(zero, 5, 0)
test_constant(zero, -4.1, 0)
@testset "Constants" for x in (-0.1, 6.4, 1.0+0.5im, -10.0+0im, 0+200im)
test_scalar(one, x)
test_scalar(zero, x)
end
end

0 comments on commit 0d234c6

Please sign in to comment.