Skip to content

Commit 83bcc9d

Browse files
authored
Merge pull request #18641 from JuliaLang/ksh/misctest
Few miscellaneous tests
2 parents ca16ac6 + 30fbd88 commit 83bcc9d

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

test/arrayops.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ a[1,1,2,2,1] = 30
6868
@test a[1,2,1,1,2] == 20
6969
@test a[1,1,2,2,1] == 30
7070

71+
@test_throws ArgumentError reinterpret(Int8, a)
72+
7173
b = reshape(a, (32,))
7274
@test b[1] == 10
7375
@test b[19] == 20

test/intfuncs.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ end
8787
let n = rand(Int)
8888
@test ndigits(n) == ndigits(big(n)) == ndigits(n, 10)
8989
end
90+
@test ndigits(Int8(5)) == ndigits(5)
9091

9192
@test bin('3') == "110011"
9293
@test bin('3',7) == "0110011"
@@ -124,10 +125,14 @@ end
124125
@test count_zeros(Int64(1)) == 63
125126

126127
@test factorial(3) == 6
128+
@test factorial(Int8(3)) === 6
127129
@test_throws DomainError factorial(-3)
130+
@test_throws DomainError factorial(Int8(-3))
128131

129132
@test isqrt(4) == 2
130133
@test isqrt(5) == 2
134+
@test isqrt(Int8(4)) === Int8(2)
135+
@test isqrt(Int8(5)) === Int8(2)
131136
# issue #4884
132137
@test isqrt(9223372030926249000) == 3037000498
133138
@test isqrt(typemax(Int128)) == parse(Int128,"13043817825332782212")

test/numbers.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ f9085() = typemax(UInt64) != 2.0^64
10201020

10211021
@test @inferred(rationalize(Int, 3.0, 0.0)) === 3//1
10221022
@test @inferred(rationalize(Int, 3.0, 0)) === 3//1
1023+
@test_throws ArgumentError rationalize(Int, big(3.0), -1.)
10231024

10241025
for a = -5:5, b = -5:5
10251026
if a == b == 0; continue; end

0 commit comments

Comments
 (0)