Skip to content

Commit

Permalink
Merge pull request #1260 from contradict/fix_semipoly_test
Browse files Browse the repository at this point in the history
Handle `BasicSymbolic` expressions in test
  • Loading branch information
ChrisRackauckas authored Sep 25, 2024
2 parents 7680446 + 1930715 commit e2bf913
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/semipoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ end

const components = [2, a, b, c, x, y, z, (1+x), (1+y)^2, z*y, z*x]

function verify(t::Symbolics.BasicSymbolic{Number}, d, wrt, nl)
verify(Num(t), d, wrt, nl)
end

function verify(t, d, wrt, nl)
try
iszero(t - (isempty(d) ? nl : sum(k*v for (k, v) in d) + nl))
Expand Down Expand Up @@ -505,3 +509,7 @@ for i=1:20
trial()
end
end

@testset "Extracted from fuzz testing" begin
@test verify(2.25(2.0 + 2c)*(c^2), Dict{Any, Any}(c^3 => 4.5, c^2 => 4.5), Num[c, y, z], 0)
end

0 comments on commit e2bf913

Please sign in to comment.