示例工程 03-numbers
03-numbers/04-float-to-int-boundaries/_test.lua
-- @runtimes lua54
local h = require("harness")
local m = require("main")
h.describe("浮点边界", function()
h.it("2^53 之后整数不再精确", function()
local result = m.run(function() end)
h.eq(result.exact, true)
end)
h.it("超出范围 tointeger 返回 nil", function()
local result = m.run(function() end)
h.eq(result.beyond, true)
end)
h.it("整数值浮点可转换", function()
local result = m.run(function() end)
h.eq(result.converted, 3)
end)
end)
h.run()