示例工程 03-numbers

03-numbers/05-number-bench/_test.lua

lua · 0.5 KB

-- @runtimes lua54 luajit
local h = require("harness")
local m = require("main")
 
h.describe("整数与浮点循环", function()
	h.it("两种循环都完成", function()
		local result = m.run(function() end)
		h.eq(result.int_time >= 0, true)
		h.eq(result.float_time >= 0, true)
	end)
 
	h.it("LuaJIT 没有整数子类型", function()
		if h.runtime() == "luajit" then
			local result = m.run(function() end)
			h.eq(result.has_integer, false)
		end
	end)
end)
 
h.run()