Skip to content

Commit bb59236

Browse files
authored
add eachfactor tests
1 parent 855540e commit bb59236

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ end
239239
# factor returns a sorted dict
240240
@test all([issorted(collect(factor(rand(Int)))) for x in 1:100])
241241

242+
# test eachfactor iteration
243+
@test iterate(eachfactor(36)) == ((2, 2), (9, 3))
244+
@test iterate(eachfactor(7^2*5^3)) == ((5, 3), (49, 5))
245+
@test iterate(eachfactor(257) == ((257, 1), (1, 257))
246+
@test iterate(eachfactor(nextprime(2^16))) == ((65537, 1), (1, 65537))
247+
242248
# Lucas-Lehmer
243249
@test !ismersenneprime(2047)
244250
@test ismersenneprime(8191)

0 commit comments

Comments
 (0)