From 3188ed1961f7ccca657395bbc512b1f72c684cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Mon, 25 Sep 2017 10:26:35 +0200 Subject: [PATCH] Add range tests --- src/monovec.jl | 1 + test/monovec.jl | 1 + test/polynomial.jl | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/monovec.jl b/src/monovec.jl index d310ee34..c0432ad4 100644 --- a/src/monovec.jl +++ b/src/monovec.jl @@ -1,5 +1,6 @@ export monovec, monovectype, emptymonovec, sortmonovec, mergemonovec +monomials(v::AbstractVariable, args...) = monomials((v,), args...) """ emptymonovec(p::AbstractPolynomialLike) diff --git a/test/monovec.jl b/test/monovec.jl index 079c9220..875942f8 100644 --- a/test/monovec.jl +++ b/test/monovec.jl @@ -48,5 +48,6 @@ @test monomialtype([x*y, x+y]) <: AbstractMonomial @test monovec([x, x^2]) != monovec([x*y, x^2*y]) + @test monomials(x, 1:3) == monovec([x^3, x, x^2]) @test monomials((x, y), 2) != monomials((x, y), 1) end diff --git a/test/polynomial.jl b/test/polynomial.jl index cb2efef4..9ad6196f 100644 --- a/test/polynomial.jl +++ b/test/polynomial.jl @@ -21,6 +21,9 @@ #@inferred one(1.0 + x) @inferred zero(1.0 + x) + @test polynomial(1:2, [x, x^2]) == x + 2x^2 + @test polynomial(1:2, monomials(x, 1:2)) == 2x + x^2 + @test terms(polynomial(1 + x + x^2 - x + x^2)) == [2x^2, 1] @test terms(CustomPoly(1 + x + x^2 - x + x^2)) == [2x^2, 1]