Skip to content

Commit 010f817

Browse files
committed
Test sqrt for rings
1 parent 244d7a6 commit 010f817

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/Rings-test.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ end
6363
end
6464
end
6565

66+
@testset "sqrt" begin
67+
Base.sqrt(a::EuclideanRingResidueRingElem{BigInt}) = parent(a)(BigInt(sqrt(a.data)))
68+
R = residue_ring(ZZ, 101)[1]
69+
70+
@test sqrt(R(81), check=true) == R(9)
71+
@test_throws ErrorException sqrt(R(82), check=true)
72+
@test is_square_with_sqrt(R(16)) == (true, R(4))
73+
@test is_square_with_sqrt(R(15))[1] == false
74+
end
75+
6676
@testset "properties" begin
6777
@test is_perfect(QQ)
6878
@test is_perfect(GF(2))

0 commit comments

Comments
 (0)