Skip to content

Commit 62ec3df

Browse files
committed
Only test new show for DynamicPolynomials
1 parent af30ed9 commit 62ec3df

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ function try_import(name::Symbol)
1616
end
1717
end
1818

19+
global implementation = :DynamicPolynomials
20+
1921
if try_import(:DynamicPolynomials)
2022
Mod = DynamicPolynomials
2123
include("commutativetests.jl")
@@ -24,5 +26,6 @@ end
2426

2527
if try_import(:TypedPolynomials)
2628
Mod = TypedPolynomials
29+
global implementation = :TypedPolynomials
2730
include("commutativetests.jl")
2831
end

test/show.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
@test sprint(show, x^2 - (1.0 + 3.1im) * x) == "x² + (-1.0 - 3.1im)x"
2727
@test sprint(show, [1.0, 2.0] * x) == "([1.0, 2.0])x"
2828

29-
# This is only supported by DynamicPolynomials so far
30-
# @polyvar x[0:9]
31-
# @test sprint(show, sum(i*x[i]^i for i=1:10)) == "10x₉¹⁰ + 9x₈⁹ + 8x₇⁸ + 7x₆⁷ + 6x₅⁶ + 5x₄⁵ + 4x₃⁴ + 3x₂³ + 2x₁² + x₀"
32-
# @test sprint(show, "text/latex", sum(i*x[i]^i for i=1:10)) == "10x_{9}^{10} + 9x_{8}^{9} + 8x_{7}^{8} + 7x_{6}^{7} + 6x_{5}^{6} + 5x_{4}^{5} + 4x_{3}^{4} + 3x_{2}^{3} + 2x_{1}^{2} + x_{0}"
33-
#
34-
# @polyvar A[1:2, 1:2]
35-
# @test sprint(show, sum(A)) == "A₁₋₁ + A₂₋₁ + A₁₋₂ + A₂₋₂"
36-
# @test sprint(show, "text/latex", sum(A)) == "A_{1,1} + A_{2,1} + A_{1,2} + A_{2,2}"
29+
#This is only supported by DynamicPolynomials so far
30+
if implementation == :DynamicPolynomials
31+
Mod.@polyvar x[0:9]
32+
@test sprint(show, sum(i*x[i]^i for i=1:10)) == "10x₉¹⁰ + 9x₈⁹ + 8x₇⁸ + 7x₆⁷ + 6x₅⁶ + 5x₄⁵ + 4x₃⁴ + 3x₂³ + 2x₁² + x₀"
33+
@test sprint(show, "text/latex", sum(i*x[i]^i for i=1:10)) == "10x_{9}^{10} + 9x_{8}^{9} + 8x_{7}^{8} + 7x_{6}^{7} + 6x_{5}^{6} + 5x_{4}^{5} + 4x_{3}^{4} + 3x_{2}^{3} + 2x_{1}^{2} + x_{0}"
34+
35+
Mod.@polyvar A[1:2, 1:2]
36+
@test sprint(show, sum(A)) == "A₁₋₁ + A₂₋₁ + A₁₋₂ + A₂₋₂"
37+
@test sprint(show, "text/latex", sum(A)) == "A_{1,1} + A_{2,1} + A_{1,2} + A_{2,2}"
38+
end
3739
end

0 commit comments

Comments
 (0)