@@ -139,17 +139,31 @@ function univariate_gcd_test(algo=GeneralizedEuclideanAlgorithm())
139
139
end
140
140
141
141
function _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))
143
147
end
144
148
function _mult_test (a, b)
145
149
@test iszero (rem (a, b))
146
150
@test iszero (rem (b, a))
147
151
end
148
152
function mult_test (expected, a, b, algo)
149
- g = @inferred gcd (a, b, algo)
153
+ g = @inferred MP . _simplifier (a, b, algo)
150
154
@test g isa promote_type (polynomialtype (a), polynomialtype (b))
151
155
_mult_test (expected, g)
152
156
end
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
153
167
function sym_test (a, b, g, algo)
154
168
mult_test (g, a, b, algo)
155
169
mult_test (g, b, a, algo)
@@ -164,6 +178,7 @@ function multivariate_gcd_test(::Type{T}, algo=GeneralizedEuclideanAlgorithm())
164
178
Mod. @polyvar x y z
165
179
o = one (T)
166
180
zr = zero (T)
181
+ sym_test (o, o * x, o, algo)
167
182
sym_test (o * x, zr * x, o * x, algo)
168
183
sym_test (o * x + o, zr * x, o * x + o, algo)
169
184
# Inspired from https://github.com/JuliaAlgebra/MultivariatePolynomials.jl/issues/160
@@ -224,7 +239,8 @@ function multivariate_gcd_test(::Type{T}, algo=GeneralizedEuclideanAlgorithm())
224
239
end
225
240
sym_test (b, c, x + y + z, algo)
226
241
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 )))
228
244
triple_test (a, b, c, algo)
229
245
end
230
246
end
312
328
univariate_gcd_test (GeneralizedEuclideanAlgorithm (primitive_rem, skip_last))
313
329
end
314
330
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 ]
316
332
if T != Rational{BigInt} || VERSION >= v " 1.6"
317
333
# `gcd` for `Rational{BigInt}` got defined at some point between v1.0 and v1.6
318
334
@testset " primitive_rem=$primitive_rem " for primitive_rem in [false , true ]
0 commit comments