Skip to content

Commit 7cd7e3f

Browse files
test: fix failing tests
1 parent 90fd2c7 commit 7cd7e3f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

test/basics.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ end
937937
@test_reference "inspect_output/ex.txt" sprint(io->SymbolicUtils.inspect(io, ex))
938938
@test_reference "inspect_output/ex-md.txt" sprint(io->SymbolicUtils.inspect(io, ex, metadata=true))
939939
@test_reference "inspect_output/ex-nohint.txt" sprint(io->SymbolicUtils.inspect(io, ex, hint=false))
940-
@test SymbolicUtils.pluck(ex, 12) == 2
940+
@test unwrap_const(SymbolicUtils.pluck(ex, 12)) == 2
941941
@test_reference "inspect_output/sub10.txt" sprint(io->SymbolicUtils.inspect(io, SymbolicUtils.pluck(ex, 9)))
942942
@test_reference "inspect_output/sub14.txt" sprint(io->SymbolicUtils.inspect(io, SymbolicUtils.pluck(ex, 14)))
943943
end
@@ -1156,7 +1156,7 @@ end
11561156

11571157
@testset "Negative coefficient to fractional power" begin
11581158
@syms a
1159-
@test isequal((-5a)^0.5, sqrt(5) * Pow{Number}(-a, 0.5))
1159+
@test isequal((-5a)^0.5, sqrt(5) * Term{SymReal}(^, [-a, 0.5]; type = Number, shape = ShapeVecT()))
11601160
end
11611161

11621162
@testset "Equivalent expressions across tasks are equal" begin

test/code.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ nanmath_st.rewrites[:nanmath] = true
2020
@test toexpr(a*b*c*d*e) == :($(*)($(*)($(*)($(*)(a, b), c), d), e))
2121
@test toexpr(a+b+c+d+e) == :($(+)($(+)($(+)($(+)(a, b), c), d), e))
2222
@test toexpr(a+b) == :($(+)(a, b))
23-
@test toexpr(x(t)+y(t)) == :($(+)(x(t), y(t)))
24-
@test toexpr(x(t)+y(t)+x(t+1)) == :($(+)($(+)(x(t), y(t)), x($(+)(1, t))))
23+
@test toexpr(x(t)+y(t)) == :($(+)(y(t), x(t)))
24+
@test toexpr(x(t)+y(t)+x(t+1)) == :($(+)($(+)(x($(+)(1, t)), y(t)), x(t)))
2525
s = LazyState()
2626
Code.union_rewrites!(s.rewrites, [x(t), y(t)])
27-
@test toexpr(x(t)+y(t)+x(t+1), s) == :($(+)($(+)(var"x(t)", var"y(t)"), x($(+)(1, t))))
27+
@test toexpr(x(t)+y(t)+x(t+1), s) == :($(+)($(+)(x($(+)(1, t)), var"y(t)"), var"x(t)"))
2828

2929
ex = :(let a = 3, b = $(+)(1,a)
3030
$(+)(a, b)
@@ -38,7 +38,7 @@ nanmath_st.rewrites[:nanmath] = true
3838

3939
test_repr(toexpr(Func([x(t), x],[b a+2, y(t) b], x(t)+x(t+1)+b+y(t))),
4040
:(function (var"x(t)", x; b = $(+)(2, a), var"y(t)" = b)
41-
$(+)($(+)($(+)(b, var"x(t)"), var"y(t)"), x($(+)(1, t)))
41+
$(+)($(+)($(+)(b, x($(+)(1, t))), var"y(t)"), var"x(t)")
4242
end))
4343
test_repr(toexpr(Func([DestructuredArgs([x, x(t)], :state),
4444
DestructuredArgs((a, b), :params)], [],
@@ -49,7 +49,7 @@ nanmath_st.rewrites[:nanmath] = true
4949
var"x(t)" = state[2]
5050
a = params[1]
5151
b = params[2]
52-
$(+)($(+)($(+)(a, b), var"x(t)"), x($(+)(1, t)))
52+
$(+)($(+)($(+)(a, b), x($(+)(1, t))), var"x(t)")
5353
end
5454
end))
5555

@@ -58,7 +58,7 @@ nanmath_st.rewrites[:nanmath] = true
5858
x(t+1) + x(t) + a + b)),
5959
:(function (state, params)
6060
begin
61-
$(+)($(+)($(+)(params[1], params[2]), state[2]), state[1]($(+)(1, t)))
61+
$(+)($(+)($(+)(params[1], params[2]), state[1]($(+)(1, t))), state[2])
6262
end
6363
end))
6464

test/polyform.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ end
6464
@test isequal(simplify_fractions(a), 7/expand(-(x-2)^2))
6565

6666
# https://github.com/JuliaSymbolics/Symbolics.jl/issues/968
67-
@eqtest simplify_fractions((x * y + (1//2) * x) / (2 * x)) == 1//2 * (1//2 + y)
67+
@eqtest simplify_fractions((x * y + (1//2) * x) / (2 * x)) == (1 + 2y) / 4
6868
end
6969

7070
@testset "isone iszero" begin

0 commit comments

Comments
 (0)