Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-enable BigInt hexadecimal literals #23546

Merged
merged 6 commits into from
Oct 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
re-add tests
  • Loading branch information
rfourquet committed Oct 10, 2020
commit fff4d9f73c4c8b37fffceabd4af1f55b56c0fce3
29 changes: 13 additions & 16 deletions test/numbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1691,8 +1691,7 @@ end
@test isa(0b0000000000000000000000000000000000000000000000000000000000000000,UInt64)
@test isa(0b00000000000000000000000000000000000000000000000000000000000000000,UInt128)
@test isa(0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,UInt128)
# remove BigInt unsigned integer literals #11105
@test_throws Meta.ParseError Meta.parse("0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
@test isa(0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,BigInt)
@test isa(0b11111111,UInt8)
@test isa(0b111111111,UInt16)
@test isa(0b1111111111111111,UInt16)
Expand All @@ -1702,8 +1701,7 @@ end
@test isa(0b1111111111111111111111111111111111111111111111111111111111111111,UInt64)
@test isa(0b11111111111111111111111111111111111111111111111111111111111111111,UInt128)
@test isa(0b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111,UInt128)
# remove BigInt unsigned integer literals #11105
@test_throws Meta.ParseError Meta.parse("0b111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
@test isa(0b111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111,BigInt)
end
@testset "octal literals" begin
@test 0o10 == 0x8
Expand All @@ -1719,8 +1717,7 @@ end
@test isa(0o000000000000000000000,UInt64)
@test isa(0o0000000000000000000000,UInt64)
@test isa(0o000000000000000000000000000000000000000000,UInt128)
# remove BigInt unsigned integer literals #11105
@test_throws Meta.ParseError Meta.parse("0o00000000000000000000000000000000000000000000")
@test isa(0o00000000000000000000000000000000000000000000,BigInt)
@test isa(0o11,UInt8)
@test isa(0o111,UInt8)
@test isa(0o11111,UInt16)
Expand All @@ -1732,9 +1729,8 @@ end
@test isa(0o111111111111111111111111111111111111111111,UInt128)
@test isa(0o1111111111111111111111111111111111111111111,UInt128)
@test isa(0o3777777777777777777777777777777777777777777,UInt128)
@test_throws Meta.ParseError Meta.parse("0o4000000000000000000000000000000000000000000")
# remove BigInt unsigned integer literals #11105
@test_throws Meta.ParseError Meta.parse("0o11111111111111111111111111111111111111111111")
@test isa(0o11111111111111111111111111111111111111111111,BigInt)
@test 0o4000000000000000000000000000000000000000000 == 340282366920938463463374607431768211456
@test isa(0o077, UInt8)
@test isa(0o377, UInt8)
@test isa(0o400, UInt16)
Expand All @@ -1750,7 +1746,6 @@ end
@test isa(0o0000000000000000000000000000000000000000000, UInt128)
@test isa(0o1000000000000000000000000000000000000000000, UInt128)
@test isa(0o2000000000000000000000000000000000000000000, UInt128)
@test_throws Meta.ParseError Meta.parse("0o4000000000000000000000000000000000000000000")

@test String([0o110, 0o145, 0o154, 0o154, 0o157, 0o054, 0o040, 0o127, 0o157, 0o162, 0o154, 0o144, 0o041]) == "Hello, World!"

Expand All @@ -1765,8 +1760,7 @@ end
@test isa(0x0000000000000000,UInt64)
@test isa(0x00000000000000000,UInt128)
@test isa(0x00000000000000000000000000000000,UInt128)
# remove BigInt unsigned integer literals #11105
@test_throws Meta.ParseError Meta.parse("0x000000000000000000000000000000000")
@test isa(0x000000000000000000000000000000000,BigInt)

@test isa(0x11,UInt8)
@test isa(0x111,UInt16)
Expand All @@ -1777,8 +1771,7 @@ end
@test isa(0x1111111111111111,UInt64)
@test isa(0x11111111111111111,UInt128)
@test isa(0x11111111111111111111111111111111,UInt128)
# remove BigInt unsigned integer literals #11105
@test_throws Meta.ParseError Meta.parse("0x111111111111111111111111111111111")
@test isa(0x111111111111111111111111111111111,BigInt)
end
@testset "minus sign and unsigned literals" begin
# "-" is not part of unsigned literals
Expand All @@ -1792,13 +1785,17 @@ end
@test -0o0000000000000000000001 == -(0o0000000000000000000001)
@test -0b00000000000000000000000000000000000000000000000000000000000000001 ==
-(0b00000000000000000000000000000000000000000000000000000000000000001)
@test -0x000000000000000000000000000000001 == -(0x000000000000000000000000000000001)
@test -0o0000000000000000000000000000000000000000001 ==
-(0o0000000000000000000000000000000000000000001)
@test -0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 ==
-(0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001)

@test isa(-0x00,UInt8)
@test isa(-0x0000000000000000,UInt64)
@test isa(-0x00000000000000000,UInt128)
@test isa(-0x00000000000000000000000000000000,UInt128)
# remove BigInt unsigned integer literals #11105
@test_throws Meta.ParseError Meta.parse("-0x000000000000000000000000000000000")
@test isa(-0x000000000000000000000000000000000,BigInt)
end
@testset "Float32 literals" begin
@test isa(1f0,Float32)
Expand Down