Skip to content

Commit c7250b1

Browse files
Test Expr conversions
1 parent d023a90 commit c7250b1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/variable_parsing.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using Test
44
@Var a=1.0 b
55
a1 = Variable(:a,1.0)
66
@test a1 == a
7+
@test Expr(a) == :a
78

89
@Var begin
910
a = 1.0
@@ -20,6 +21,10 @@ z1 = DependentVariable(:z,dependents = [t])
2021
@test x1 == x
2122
@test y1 == y
2223
@test z1 == z
24+
@test Expr(x) == :x
25+
@test Expr(y) == :y
26+
@test Expr(z) == :z
27+
2328
@IVar begin
2429
t
2530
s = cos(2.5)
@@ -28,11 +33,19 @@ t1 = IndependentVariable(:t)
2833
s1 = IndependentVariable(:s, cos(2.5))
2934
@test t1 == t
3035
@test s1 == s
36+
@test Expr(t) == :t
37+
@test Expr(s) == :s
38+
@test Expr(cos(t + sin(s))) == :(cos(t + sin(s)))
39+
3140
@Deriv D''~t
3241
D1 = Differential(t, 2)
3342
@test D1 == D
43+
@test Expr(D) == D
44+
3445
@Const c=0 v=2
3546
c1 = Constant(0)
3647
v1 = Constant(2)
3748
@test c1 == c
3849
@test v1 == v
50+
@test Expr(c) == 0
51+
@test Expr(v) == 2

0 commit comments

Comments
 (0)