Skip to content

Commit e577691

Browse files
committed
Add a small test
1 parent bf1dd6f commit e577691

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/generic/MPoly-test.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,3 +1877,20 @@ end
18771877
R2, (x2, y2) = polynomial_ring(QQ, [:x, :y])
18781878
@test_throws ErrorException z1 + y2
18791879
end
1880+
1881+
@testset "Generic.MPoly.Iterators" begin
1882+
R, (x, y, z) = polynomial_ring(QQ, [:x, :y, :z])
1883+
f = x * y + 2 * x - 3 * z
1884+
1885+
@test @inferred collect(exponent_vectors(f)) == [[1, 1, 0], [1, 0, 0], [0, 0, 1]]
1886+
@test @inferred collect(exponent_vectors(Vector{UInt}, f)) == [UInt[1, 1, 0], UInt[1, 0, 0], UInt[0, 0, 1]]
1887+
@test @inferred collect(coefficients(f)) == [QQ(1), QQ(2), QQ(-3)]
1888+
@test @inferred collect(terms(f)) == [x * y, 2 * x, -3 * z]
1889+
@test @inferred collect(monomials(f)) == [x * y, x, z]
1890+
1891+
@test @inferred first(exponent_vectors(f, inplace = true)) == [1, 1, 0]
1892+
@test @inferred first(exponent_vectors(Vector{UInt}, f, inplace = true)) == UInt[1, 1, 0]
1893+
@test @inferred first(coefficients(f, inplace = true)) == QQ(1)
1894+
@test @inferred first(monomials(f, inplace = true)) == x * y
1895+
@test @inferred first(terms(f, inplace = true)) == x * y
1896+
end

0 commit comments

Comments
 (0)