Skip to content

Commit fe5a640

Browse files
authored
Add unittest for LiteralReal simplification
1 parent 490011e commit fe5a640

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/rulesets.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ end
5454
@test simplify(Term(zero, [x + 2])) == 0
5555
end
5656

57+
@testset "LiteralReal" begin
58+
@syms x1::LiteralReal x2::LiteralReal
59+
s = cos(x1 * 3.2) - x2 * 5.8 + x2 * 1.2
60+
@eqtest s == cos(x1 * 3.2) - x2 * 5.8 + x2 * 1.2
61+
62+
# Prevents automatic simplification:
63+
@eqtest s != cos(x1 * 3.2) - x2 * 4.6
64+
65+
# However, manual simplification should still work:
66+
@eqtest simplify(s) == cos(3.2(x1^1)) - 4.6x2
67+
end
68+
5769
@testset "boolean" begin
5870
@syms a::Real b c
5971

0 commit comments

Comments
 (0)