Add overflow case

This commit is contained in:
Hsiao-Wei Wang
2024-02-14 22:26:58 +08:00
parent 7076fb2b75
commit 42bc6004e5

View File

@@ -21,3 +21,9 @@ def test_integer_squareroot(spec):
n = rng.randint(0, 2**64 - 1)
uint64_n = spec.uint64(n)
assert spec.integer_squareroot(uint64_n) == isqrt(n)
try:
spec.integer_squareroot(spec.uint64(2**64))
assert False
except ValueError:
pass