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 25, 2024
1 parent bf20b2d commit 2c97f0c
Show file tree
Hide file tree
Showing 7 changed files with 65 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
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
11 changes: 11 additions & 0 deletions test/generic/SparsePoly-test.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
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 2c97f0c

Please sign in to comment.