Skip to content

Commit 5ee2d60

Browse files
Written tests for typemin/typemax (#39057)
* Written tests for typemin/typemax * Added test w.r.t Int128
1 parent 82d79ce commit 5ee2d60

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/int.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,27 @@ end
395395
@test bitreverse(Int64(456618293)) === Int64(-6012608040035942400)
396396
@test bitreverse(Int32(456618293)) === Int32(-1399919400)
397397
end
398+
399+
@testset "min/max of datatype" begin
400+
@test typemin(Int8) == Int8(-128)
401+
@test typemin(UInt8) == UInt8(0)
402+
@test typemin(Int16) == Int16(-32768)
403+
@test typemin(UInt16) == UInt16(0)
404+
@test typemin(Int32) == Int32(-2147483648)
405+
@test typemin(UInt32) == UInt32(0)
406+
@test typemin(Int64) == Int64(-9223372036854775808)
407+
@test typemin(UInt64) == UInt64(0)
408+
@test typemin(Int128) == Int128(-170141183460469231731687303715884105728)
409+
@test typemin(UInt128) == UInt128(0)
410+
411+
@test typemax(Int8) == Int8(127)
412+
@test typemax(UInt8) == UInt8(255)
413+
@test typemax(Int16) == Int16(32767)
414+
@test typemax(UInt16) == UInt16(65535)
415+
@test typemax(Int32) == Int32(2147483647)
416+
@test typemax(UInt32) == UInt32(4294967295)
417+
@test typemax(Int64) == Int64(9223372036854775807)
418+
@test typemax(UInt64) == UInt64(0xffffffffffffffff)
419+
@test typemax(Int128) == Int128(170141183460469231731687303715884105727)
420+
@test typemax(UInt128) == UInt128(0xffffffffffffffffffffffffffffffff)
421+
end

0 commit comments

Comments
 (0)