Skip to content

Commit dd09d19

Browse files
committed
fix BigInt ndigits test
See #16766. `ndigits(big(0),1)` doesn't raise an error, but we were sometimes (randomly, rarely) testing that it does. This change makes the test reliable. The issue of how this case should actually behave is still open.
1 parent fa1c6f8 commit dd09d19

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/bigint.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@ ndigits_mismatch(n) = ndigits(n) != ndigits(BigInt(n))
278278
ndigits(rand(big(-999:999)), rand(63:typemax(Int)))
279279
ndigits(rand(big(-999:999)), big(2)^rand(2:999))
280280

281-
@test_throws DomainError ndigits(rand(big(-999:999)), rand(typemin(Int):1))
281+
for i in big([-20:-1;1:20])
282+
for b in -10:1
283+
@test_throws DomainError ndigits(i, b)
284+
end
285+
end
282286

283287
# conversion from float
284288
@test BigInt(2.0) == BigInt(2.0f0) == BigInt(big(2.0)) == 2

0 commit comments

Comments
 (0)