Skip to content

Commit b0f2661

Browse files
authored
fix tests
1 parent 637da5b commit b0f2661

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

tests/runtests.jl

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ using Test
22

33
@testset "iroot" begin
44
for T in (Int32, Int64, BigInt)
5-
@test iroot(T(100), 2) === T(10)
6-
@test iroot(T(101), 2) === T(10)
7-
@test iroot(T(99), 2) === T(9)
8-
@test iroot(T(1000), 3) === T(10)
9-
@test iroot(T(1001), 3) === T(10)
10-
@test iroot(T(999), 3) === T(9)
11-
@test iroot(T(10000), 4) === T(10)
12-
@test iroot(T(10001), 4) === T(10)
13-
@test iroot(T(9999), 4) === T(9)
5+
@test iroot(T(100), 2) == T(10)
6+
@test iroot(T(101), 2) == T(10)
7+
@test iroot(T(99), 2) == T(9)
8+
@test iroot(T(1000), 3) == T(10)
9+
@test iroot(T(1001), 3) == T(10)
10+
@test iroot(T(999), 3) == T(9)
11+
@test iroot(T(10000), 4) == T(10)
12+
@test iroot(T(10001), 4) == T(10)
13+
@test iroot(T(9999), 4) == T(9)
1414
end
15-
@test iroot(big(23)^50, 50) === big(23)
16-
@test iroot(big(23)^50 + 1, 50) === big(23)
17-
@test iroot(big(23)^50 - 1, 50) === big(22)
15+
@test iroot(big(23)^50, 50) == big(23)
16+
@test iroot(big(23)^50 + 1, 50) == big(23)
17+
@test iroot(big(23)^50 - 1, 50) == big(22)
1818
end
1919

2020
@testset "ispower" begin
@@ -35,28 +35,30 @@ end
3535

3636
@testset "find_exponent" begin
3737
for T in (Int32, Int64, BigInt)
38-
@test ispower(T(100)) === (T(10), 2)
39-
@test ispower(T(1)) === (T(1), 1)
40-
@test ispower(T(0)) === (T(0), 1)
41-
@test ispower(T(12)) === (T(12), 1)
42-
@test ispower(T(2^30)) === (T(2), 30)
43-
@test ispower(T(5)^10) === (T(5), 10)
44-
@test ispower(T(2^30)+1) === (T(2^30+1), 1)
45-
@test ispower(T(5)^10+1) === (T(5^10+1), 1)
38+
@test find_exponent(T(100)) === 2
39+
@test find_exponent(T(1)) === 1
40+
@test find_exponent(T(0)) === 1
41+
@test find_exponent(T(12)) === 1
42+
@test find_exponent(T(2^30)) === 30
43+
@test find_exponent(T(5)^10) === 10
44+
@test find_exponent(T(2^30)+1) === 1
45+
@test find_exponent(T(5)^10+1) === 1
4646
end
47-
@test ispower(big(5)^40) === (big(5), 30)
48-
@test ispower(big(5)^40 + 1) === (big(5)^40 + 1, 1)
49-
@test ispower(6*big(5)^40 ) === (6 * big(5)^40, 1)
47+
@test find_exponent(big(5)^40) === 40
48+
@test find_exponent(big(5)^40 + 1) === 1
49+
@test find_exponent(6*big(5)^40 ) === 1
5050
end
5151

5252
@testset "is_probably_prime" begin
5353
for T in (Int32, Int64, BigInt)
5454
@test is_probably_prime(T(2)^7-1) == true
5555
@test is_probably_prime(T(2)^13-1) == true
56-
@test is_probably_prime(T(2)^31-1) == true
56+
@test is_probably_prime(T(2)^19-1) == true
5757
@test is_probably_prime(T(2)^27-1) == false
5858
@test is_probably_prime(T(2)^23-1) == false
5959
@test is_probably_prime(T(2)^30-1) == false
6060
end
6161
@test is_probably_prime(big(2)^127-1) == true
6262
@test is_probably_prime(big(2)^128-1) == false
63+
end
64+

0 commit comments

Comments
 (0)