From 89ae12a1d834a1ee78bbb00fbabb311f2b50cbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Mon, 17 Jan 2022 17:06:27 -0500 Subject: [PATCH] Test for Issue #104 --- test/division.jl | 6 ++++++ test/monomial.jl | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/test/division.jl b/test/division.jl index 5f0c283e..af069813 100644 --- a/test/division.jl +++ b/test/division.jl @@ -196,6 +196,12 @@ function multivariate_gcd_test(::Type{T}, algo=GeneralizedEuclideanAlgorithm()) sym_test(p1, p2, x, algo) end + @testset "Issue #104" begin + p1 = o - o * x + p2 = p1 * (o * y^2 + o) + sym_test(p1, p2, p1, algo) + end + p1 = o*z - z p2 = z @test gcd(p1, p2, algo) == z diff --git a/test/monomial.jl b/test/monomial.jl index f42481b5..5d41f97d 100644 --- a/test/monomial.jl +++ b/test/monomial.jl @@ -23,9 +23,21 @@ function mapexponents_test() b = x * y c = MP.mapexponents!(+, a, b) @test variables(c) == variables(b) + @test degree(c, x) == 3 + @test degree(c, y) == 1 a = x^3 d = MP.mapexponents_to!(a, -, b, b) @test variables(d) == variables(b) + @test degree(d, x) == 0 + @test degree(d, y) == 0 + # See https://github.com/JuliaAlgebra/DynamicPolynomials.jl/pull/105 + e = x^1 + f = x * y^2 + g = MP.mapexponents!(div, e, f) + @test g === e + @test variables(e) == variables(f) + @test degree(e, x) == 1 + @test degree(e, y) == 0 end @testset "Monomial" begin