Skip to content

Commit

Permalink
add test (and gcdx)
Browse files Browse the repository at this point in the history
  • Loading branch information
fieker committed Dec 5, 2024
1 parent faf4100 commit 49b9905
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/generic/Residue-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,30 @@ end
@test gen(S) == S(x)
@test gens(S) == elem_type(S)[one(S), gen(S), gen(S)^2]
end

@testset "EuclideanRingResidueRingElem.divrem" begin
R, x = polynomial_ring(GF(5), "x")
S, _ = residue_ring(R, (x^3)*(x+1)^2)

f = S(x^2*(x+1))
g = S(x*(x+1)^2)
q, r = divrem(f, g)
@test f == q*g+r
@test degree(data(r)) < degree(data(g))

h, r, s = gcdx(f, g)
@test h == S(x^2+x)
@test h == r*f+s*g

f *= (x+2)
g *= (x^2+x+2)
q, r = divrem(f, g)
@test f == q*g+r

h, r, s = gcdx(f, g)
@test h == S(x^2+x)
@test h == r*f+s*g
end



0 comments on commit 49b9905

Please sign in to comment.