Skip to content

Commit 905ee7c

Browse files
authored
Merge pull request #134 from JuliaAlgebra/bl/ncmonotest
Add test for noncommutative monomial
2 parents b54c6a1 + 0ea8f78 commit 905ee7c

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

test/ncmonomial.jl

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
@testset "Non-commutative Monomial" begin
22
Mod.@ncpolyvar x
3-
X = constantmonomial(typeof(x))
4-
@test nvariables(X) == 0
5-
@test isempty(X.vars)
6-
@test isempty(X.z)
7-
X = constantmonomial(x)
8-
@test nvariables(X) == 1
9-
@test variables(X)[1] == x
10-
@test collect(exponents(X)) == [0]
11-
X = monomial(x)
12-
@test nvariables(X) == 1
13-
@test variables(X)[1] == x
14-
@test collect(exponents(X)) == [1]
15-
X = x^0
16-
Y = X * x^2
17-
@test nvariables(Y) == 1
18-
@test variables(Y)[1] == x
19-
@test collect(exponents(Y)) == [2]
20-
Y = x^2 * X
21-
@test nvariables(Y) == 1
22-
@test variables(Y)[1] == x
23-
@test collect(exponents(Y)) == [2]
3+
X_ = constantmonomial(typeof(x))
4+
@test nvariables(X_) == 0
5+
@test isempty(X_.vars)
6+
@test isempty(X_.z)
7+
X0 = constantmonomial(x)
8+
for Y in [x^0, X0]
9+
@test nvariables(Y) == 1
10+
@test variables(Y)[1] == x
11+
@test collect(exponents(Y)) == [0]
12+
end
13+
for X in [X_, X0]
14+
for Y in [monomial(x), x^1, x * X, X * x]
15+
@test nvariables(Y) == 1
16+
@test variables(Y)[1] == x
17+
@test collect(exponents(Y)) == [1]
18+
end
19+
end
20+
for X in [X_, X0]
21+
for Y in [x^2, X * x^2, x^2 * X]
22+
@test nvariables(Y) == 1
23+
@test variables(Y)[1] == x
24+
@test collect(exponents(Y)) == [2]
25+
end
26+
end
2427
end
2528
@testset "Non-commutative MonomialVector" begin
2629
Mod.@ncpolyvar x y

0 commit comments

Comments
 (0)