Skip to content

Commit f0cfce0

Browse files
committed
define getindex for testing
1 parent 85fbdb2 commit f0cfce0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/basics.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,10 @@ end
196196
@test repr(2a+1+3a^2+2b+3b^2+4a*b) == "1 + 2a + 2b + 3(a^2) + 4a*b + 3(b^2)"
197197

198198
@syms a b[1:3] c d[1:3]
199-
@test repr(a + b[3] + b[1] + d[2] + c) == "a + b[1] + b[3] + c + d[2]"
200-
@test repr(expand((c + b[3] - d[1])^3)) == "b[3]^3 + 3(b[3]^2)*c - 3(b[3]^2)*d[1] + 3b[3]*(c^2) - 6b[3]*c*d[1] + 3b[3]*(d[1]^2) + c^3 - 3(c^2)*d[1] + 3c*(d[1]^2) - (d[1]^3)"
199+
get(x, i) = term(getindex, x, i, type=Number)
200+
b1, b3, d1, d2 = get(b,1),get(b,3), get(d,1), get(d,2)
201+
@test repr(a + b3 + b1 + d2 + c) == "a + b[1] + b[3] + c + d[2]"
202+
@test repr(expand((c + b3 - d1)^3)) == "b[3]^3 + 3(b[3]^2)*c - 3(b[3]^2)*d[1] + 3b[3]*(c^2) - 6b[3]*c*d[1] + 3b[3]*(d[1]^2) + c^3 - 3(c^2)*d[1] + 3c*(d[1]^2) - (d[1]^3)"
201203
end
202204

203205
@testset "inspect" begin

0 commit comments

Comments
 (0)