Created
May 17, 2019 07:09
-
-
Save ynezz/2c231e22e51e7ca6680fc0811ad9d8fb to your computer and use it in GitHub Desktop.
Lua number parsing test cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local test_cases = { | |
{ 0x7fffffff, "2147483647" }, | |
{ 2147483647, "2147483647" }, | |
{ 0xffffffff, "4294967295" }, | |
{ 4294967295, "4294967295" }, | |
{ 0x7fffffffffffffff, "9.2233720368548e+18" }, | |
{ 9223372036854775807, "9.2233720368548e+18" }, | |
{ 0xffffffffffffffff, "1.844674407371e+19" }, | |
{ 18446744073709551615, "1.844674407371e+19" }, | |
{ 0x100000000, "4294967296" }, | |
{ 4294967296, "4294967296" }, | |
{ 0x100000000000, "17592186044416" }, | |
{ 17592186044416, "17592186044416" }, | |
{ 0x80000000, "2147483648" }, | |
{ 2147483648, "2147483648" }, | |
{ 0x800000000000, "1.4073748835533e+14" }, | |
{ 140737488355328, "1.4073748835533e+14" }, | |
} | |
for _, test in pairs(test_cases) do | |
assert(tostring(test[1]) == test[2], test[2]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment