Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shashi committed Feb 12, 2020
1 parent 65407e2 commit 0b0c130
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/symbolic.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export @vars, term, @fun

Base.:(==)(a::Symbolic, b::Symbolic) = a === b || isequal(a,b)

#### Variables

"""
Expand Down
8 changes: 4 additions & 4 deletions test/rewrite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ end
@test rewriter(@rule (~x)^(~x) => ~x)(a^a) === a
@test rewriter(@rule (~x)^(~x) => ~x)(b^a) === nothing
@test rewriter(@rule (~x)^(~x) => ~x)(a+a) === nothing
@test rewriter(@rule (~x)^(~x) => ~x)(sin(a)^sin(a)) === sin(a)
@test rewriter(@rule (~x*~y + ~x*~z) => ~x * (~y+~z))(a*b + a*c) === a*(b+c)
@test rewriter(@rule (~x)^(~x) => ~x)(sin(a)^sin(a)) == sin(a)
@test rewriter(@rule (~x*~y + ~x*~z) => ~x * (~y+~z))(a*b + a*c) == a*(b+c)

@test rewriter(@rule +(~~x) => ~~x)(a + b) == (a,b)
@test rewriter(@rule +(~~x) => ~~x)(a + b + c) == (a+b,c)
@test rewriter(@rule +(~~x) => ~~x)(+(a, b, c)) == (a+b,c)
@test rewriter(@rule +(~~x) => ~~x)(a + b + c) == (a,b,c)
@test rewriter(@rule +(~~x) => ~~x)(+(a, b, c)) == (a,b,c)
@test rewriter(@rule +(~~x,~y, ~~x) => (~~x, ~y))(term(+,9,8,9,type=Any)) == ((9,),8)
@test rewriter(@rule +(~~x,~y, ~~x) => (~~x, ~y, ~~x))(term(+,9,8,9,9,8,type=Any)) == ((9,8), 9, (9,8))
@test rewriter(@rule +(~~x,~y,~~x) => (~~x, ~y, ~~x))(term(+,6,type=Any)) == ((), 6, ())

0 comments on commit 0b0c130

Please sign in to comment.