@@ -139,17 +139,31 @@ function univariate_gcd_test(algo=GeneralizedEuclideanAlgorithm())
139139end
140140
141141function _mult_test (a:: Number , b)
142- return @test iszero (maxdegree (b))
142+ @test iszero (maxdegree (b))
143+ end
144+ function _mult_test (a:: Number , b:: Number )
145+ @test iszero (rem (a, b))
146+ @test iszero (rem (b, a))
143147end
144148function _mult_test (a, b)
145149 @test iszero (rem (a, b))
146150 @test iszero (rem (b, a))
147151end
148152function mult_test (expected, a, b, algo)
149- g = @inferred gcd (a, b, algo)
153+ g = @inferred MP . _simplifier (a, b, algo)
150154 @test g isa promote_type (polynomialtype (a), polynomialtype (b))
151155 _mult_test (expected, g)
152156end
157+ function mult_test (expected, a:: Number , b, algo)
158+ g = @inferred MP. _simplifier (a, b, algo)
159+ @test g isa promote_type (typeof (a), MP. coefficienttype (b))
160+ _mult_test (expected, g)
161+ end
162+ function mult_test (expected, a, b:: Number , algo)
163+ g = @inferred MP. _simplifier (a, b, algo)
164+ @test g isa promote_type (MP. coefficienttype (a), typeof (b))
165+ _mult_test (expected, g)
166+ end
153167function sym_test (a, b, g, algo)
154168 mult_test (g, a, b, algo)
155169 mult_test (g, b, a, algo)
@@ -164,6 +178,7 @@ function multivariate_gcd_test(::Type{T}, algo=GeneralizedEuclideanAlgorithm())
164178 Mod. @polyvar x y z
165179 o = one (T)
166180 zr = zero (T)
181+ sym_test (o, o * x, o, algo)
167182 sym_test (o * x, zr * x, o * x, algo)
168183 sym_test (o * x + o, zr * x, o * x + o, algo)
169184 # Inspired from https://github.com/JuliaAlgebra/MultivariatePolynomials.jl/issues/160
@@ -224,7 +239,8 @@ function multivariate_gcd_test(::Type{T}, algo=GeneralizedEuclideanAlgorithm())
224239 end
225240 sym_test (b, c, x + y + z, algo)
226241 sym_test (c, a, z^ 3 + y^ 2 + x, algo)
227- if T != Int || (algo != GeneralizedEuclideanAlgorithm (false , false ) && algo != GeneralizedEuclideanAlgorithm (true , false ) && algo != GeneralizedEuclideanAlgorithm (false , true ))
242+ if (T != Int || (algo != GeneralizedEuclideanAlgorithm (false , false ) && algo != GeneralizedEuclideanAlgorithm (true , false ) && algo != GeneralizedEuclideanAlgorithm (false , true ))) &&
243+ (T != Float64 || (algo != GeneralizedEuclideanAlgorithm (false , true ) && algo != GeneralizedEuclideanAlgorithm (true , true )))
228244 triple_test (a, b, c, algo)
229245 end
230246end
312328 univariate_gcd_test (GeneralizedEuclideanAlgorithm (primitive_rem, skip_last))
313329 end
314330 end
315- @testset " Multivariate gcd $T " for T in [Int, BigInt, Rational{BigInt}]
331+ @testset " Multivariate gcd $T " for T in [Int, BigInt, Rational{BigInt}, Float64 ]
316332 if T != Rational{BigInt} || VERSION >= v " 1.6"
317333 # `gcd` for `Rational{BigInt}` got defined at some point between v1.0 and v1.6
318334 @testset " primitive_rem=$primitive_rem " for primitive_rem in [false , true ]
0 commit comments