Skip to content

Commit

Permalink
Add some conformance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Apr 26, 2024
1 parent bf20b2d commit 5cebfcc
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/generic/AbsMSeries-test.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
function test_elem(R::AbstractAlgebra.Generic.AbsMSeriesRing{BigInt})
rand(R, 0:12, -10:10)
end

@testset "Generic.AbsMSeries.conformance" begin
R, (x, y) = power_series_ring(ZZ, [5, 3], ["x", "y"])
test_Ring_interface(R)
end

@testset "Generic.AbsMSeries.constructors" begin
S, x = polynomial_ring(ZZ, "x")

Expand Down
9 changes: 9 additions & 0 deletions test/generic/AbsSeries-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
# Note: only useful to distinguish rings and fields for 1/2, 3/4, 5/6 if the
# algos differ, and 7 can often stand in for 5/6 if the algorithm supports it.

function test_elem(R::AbstractAlgebra.Generic.AbsPowerSeriesRing{BigInt})
rand(R, 0:12, -10:10)
end

@testset "Generic.AbsSeries.conformance" begin
R, x = power_series_ring(ZZ, 30, "x", model=:capped_absolute)
test_Ring_interface(R)
end

@testset "Generic.AbsSeries.types" begin
@test abs_series_type(BigInt) == Generic.AbsSeries{BigInt}
@test abs_series_type(Rational{BigInt}) == Generic.AbsSeries{Rational{BigInt}}
Expand Down
10 changes: 10 additions & 0 deletions test/generic/FunctionField-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ U2, z2 = R2["z2"]
P2 = [(x2 + 1)*z2 + (x2 + 2), z2 + (x2 + 1)//(x2 + 2), z2^2 + 3z2 + 1,
(x2^2 + 1)//(x2 + 1)*z2^5 + 4z2^4 + (x2 + 2)*z2^3 + x2//(x2 + 1)*z2 + 1//(x2 + 1)]

# FIXME/TODO: conformance tests run into infinite loop???
#function test_elem(R::AbstractAlgebra.Generic.FunctionField{Rational{BigInt}})
# rand(R, 1:10, -10:10)
#end
#
#@testset "Generic.FunctionField.conformance" begin
# S, y = function_field(P1[4], "y")
# test_Ring_interface(S)
#end

@testset "Generic.FunctionField.constructors" begin
@test function_field(P1[1], "y")[1] === function_field(P1[1], "y", cached=true)[1]
@test function_field(P1[1], "y", cached=true)[1] !== function_field(P1[1], "y", cached=false)[1]
Expand Down
9 changes: 9 additions & 0 deletions test/generic/LaurentSeries-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
# Note: only useful to distinguish rings and fields for 1/2, 3/4, 5/6 if the
# algos differ, and 7 can often stand in for 5/6 if the algorithm supports it.

function test_elem(R::AbstractAlgebra.Generic.LaurentSeriesRing{BigInt})
rand(R, 0:12, -10:10)
end

@testset "Generic.LaurentSeries.conformance" begin
R, x = laurent_series_ring(ZZ, 10, "x")
test_Ring_interface(R)
end

@testset "Generic.LaurentSeries.constructors" begin
R, x = laurent_series_ring(ZZ, 30, "x")

Expand Down
9 changes: 9 additions & 0 deletions test/generic/PuiseuxSeries-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
# Note: only useful to distinguish rings and fields for 1/2, 3/4, 5/6 if the
# algos differ, and 7 can often stand in for 5/6 if the algorithm supports it.

function test_elem(R::AbstractAlgebra.Generic.PuiseuxSeriesRing{BigInt})
rand(R, -12:12, 1:6, -10:10)
end

@testset "Generic.PuiseuxSeries.conformance" begin
R, x = puiseux_series_ring(ZZ, 10, "x")
test_Ring_interface(R)
end

@testset "Generic.PuiseuxSeries.constructors" begin
R, x = puiseux_series_ring(ZZ, 30, "x")

Expand Down
9 changes: 9 additions & 0 deletions test/generic/RationalFunctionField-test.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
function test_elem(R::AbstractAlgebra.Generic.RationalFunctionField{Rational{BigInt}})
rand(R, 0:3, -3:3)
end

@testset "Generic.FunctionField.conformance" begin
S, x = rational_function_field(QQ, "x")
test_Ring_interface(S)
end

@testset "Generic.RationalFunctionField.constructors" begin
# Univariate

Expand Down
9 changes: 9 additions & 0 deletions test/generic/RelSeries-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
# Note: only useful to distinguish rings and fields for 1/2, 3/4, 5/6 if the
# algos differ, and 7 can often stand in for 5/6 if the algorithm supports it.

function test_elem(R::AbstractAlgebra.Generic.RelPowerSeriesRing{BigInt})
rand(R, 0:12, -10:10)
end

@testset "Generic.RelSeries.conformance" begin
R, x = power_series_ring(ZZ, 10, "x")
test_Ring_interface(R)
end

@testset "Generic.RelSeries.types" begin
@test rel_series_type(BigInt) == Generic.RelSeries{BigInt}
@test rel_series_type(Rational{BigInt}) == Generic.RelSeries{Rational{BigInt}}
Expand Down
12 changes: 12 additions & 0 deletions test/generic/SparsePoly-test.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# FIXME/TODO: get these conformance tests to work and pass
#function test_elem(Rx::AbstractAlgebra.Generic.SparsePolyRing)
# R = base_ring(Rx)
# x = gen(Rx)
# return sum(x^(5*i) * test_elem(R) for i in 1:rand(0:6); init=zero(Rx))
#end
#
#@testset "Generic.SparsePoly.conformance" begin
# R, x = SparsePolynomialRing(ZZ, "x")
# test_Ring_interface(R)
#end

@testset "Generic.SparsePoly.constructors" begin
R, x = SparsePolynomialRing(ZZ, "x")
S, y = SparsePolynomialRing(R, "y")
Expand Down

0 comments on commit 5cebfcc

Please sign in to comment.