Skip to content

Commit ecee8c6

Browse files
committed
Migrate tests from DynamicPolynomials
1 parent e40f120 commit ecee8c6

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

test/ncmonomial.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
@test collect(exponents(Y)) == [2]
2525
end
2626
end
27+
@testset "Issue #71 of DynamicPolynomials" begin
28+
Mod.@ncpolyvar x y
29+
@test x^0 * y == y * x^0
30+
end
2731
end
2832
@testset "Non-commutative MonomialVector" begin
2933
Mod.@ncpolyvar x y

test/ncoperators.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,10 @@
4343
@test q isa AbstractPolynomialLike{Float64}
4444
@test q == 0
4545
end
46+
@testset "Noncommutative quadratic" begin
47+
Mod.@ncpolyvar x[1:2]
48+
Q = Hermitian([1 2 + 3im; 2 - 3im 4])
49+
p = 1x[1]^2 + (2 + 3im) * x[1] * x[2] + (2 - 3im) * x[2] * x[1] + 4x[2]^2
50+
@test polynomial(Q, x) == p
51+
@test polynomial(Q, monovec(x)) == p
52+
end

test/substitution.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,14 @@ import Test: @inferred
6767

6868
Mod.@polyvar x y
6969
@test subs([x^2 + y, x + y], x => y) == [y^2+y, 2y]
70+
71+
@testset "Subs with no variables" begin
72+
Mod.@polyvar x
73+
t = convert(termtype(x, Int), 3)
74+
@test t == @inferred subs(t, x => x + 1)
75+
@test t == @inferred subs(t, x => x + 1.0)
76+
@test t == @inferred subs(t, x => 1x)
77+
@test t == @inferred subs(t, x => 1.0x)
78+
@test t == @inferred subs(t, x => 1.0)
79+
end
7080
end

0 commit comments

Comments
 (0)