@@ -247,11 +247,16 @@ end
247247@test all ([issorted (collect (factor (rand (Int)))) for x in 1 : 100 ])
248248
249249# test eachfactor iteration
250- @test iterate (eachfactor (36 )) == ((2 , 2 ), (9 , 3 ))
251- @test iterate (eachfactor (7 ^ 2 * 5 ^ 3 )) == ((5 , 3 ), (49 , 5 ))
252- @test iterate (eachfactor (257 )) == ((257 , 1 ), (1 , 257 ))
253- @test iterate (eachfactor (nextprime (2 ^ 16 ))) == ((65537 , 1 ), (1 , 65537 ))
254-
250+ for T in (Int32, Int64, BigInt)
251+ @test iterate (eachfactor (T (36 ))) == ((T (2 ), 2 ), T .((9 , 3 )))
252+ @test iterate (eachfactor (T (7 ^ 2 * 5 ^ 3 ))) == ((T (5 ), 3 ), T .((49 , 5 )))
253+ @test iterate (eachfactor (T (257 ))) == ((T (257 ), 1 ), T .((1 , 257 )))
254+ @test iterate (eachfactor (T (nextprime (2 ^ 16 )))) == ((T (65537 ), 1 ), T .((1 , 65537 )))
255+ for (p,e) in eachfactor (T (901800900 ))
256+ @test (p,e) isa Tuple{T, Int}
257+ end
258+ end
259+
255260# Lucas-Lehmer
256261@test ! ismersenneprime (2047 )
257262@test ismersenneprime (8191 )
@@ -341,7 +346,7 @@ divisors_brute_force(n) = [d for d in one(n):n if iszero(n % d)]
341346
342347 for n in 2 : 1000
343348 ds = divisors (T (n))
344- @test ds == divisors (- T (n))
349+ @test ds == divisors (- T (n))
345350 @test sort! (ds) == divisors_brute_force (T (n))
346351 end
347352end
0 commit comments