Skip to content

Commit

Permalink
Don't require base_ring in ring conformance tests (#1946)
Browse files Browse the repository at this point in the history
Not all rings provide this, nor should they have to. But *if* a ring
provides it, it should be compatible with `base_ring_type`.
  • Loading branch information
fingolfin authored Dec 23, 2024
1 parent e5916d3 commit 82c1b6a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/Rings-conformance-tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,13 @@ function test_NCRing_interface(R::AbstractAlgebra.NCRing; reps = 50)
@test is_domain_type(T) isa Bool
@test is_exact_type(T) isa Bool

@test base_ring_type(R) == typeof(base_ring(R))
@test base_ring_type(zero(R)) == typeof(base_ring(zero(R)))
@test base_ring_type(typeof(R)) == typeof(base_ring(R))
@test base_ring_type(T) == typeof(base_ring(zero(R)))
# if the ring supports base_ring, verify it also supports base_ring_type and is consistent
if applicable(base_ring, R)
@test base_ring_type(R) == typeof(base_ring(R))
@test base_ring_type(zero(R)) == typeof(base_ring(zero(R)))
@test base_ring_type(typeof(R)) == typeof(base_ring(R))
@test base_ring_type(T) == typeof(base_ring(zero(R)))
end

# some rings don't support characteristic and raise an exception (see issue #993)
try ch = characteristic(R)
Expand Down

0 comments on commit 82c1b6a

Please sign in to comment.