From d0ff66c9abe9d6abbca12fd811e0c3cb69c1033a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 22 Nov 2019 23:26:32 +0800 Subject: =?UTF-8?q?=E6=95=B4=E7=90=86=E4=B8=80=E4=B8=8B=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/test/full/example.lua | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 script-beta/test/full/example.lua (limited to 'script-beta/test/full/example.lua') diff --git a/script-beta/test/full/example.lua b/script-beta/test/full/example.lua new file mode 100644 index 00000000..5b096655 --- /dev/null +++ b/script-beta/test/full/example.lua @@ -0,0 +1,43 @@ +local util = require 'utility' +local parser = require 'parser' +local files = require 'files' +local diag = require 'core.diagnostics' + +-- 临时 +local function testIfExit(path) + local buf = util.loadFile(path:string()) + if buf then + local vm + + local clock = os.clock() + local max = 100 + local need + for i = 1, max do + vm = TEST(buf) + local passed = os.clock() - clock + if passed >= 1.0 or i == max then + need = passed / i + break + end + end + print(('基准编译测试[%s]单次耗时:%.10f'):format(path:filename():string(), need)) + + local clock = os.clock() + local max = 100 + local need + local lines = parser:lines(buf) + for i = 1, max do + files.removeAll() + files.setText('', buf) + diag('') + local passed = os.clock() - clock + if passed >= 1.0 or i == max then + need = passed / i + break + end + end + print(('基准诊断测试[%s]单次耗时:%.10f'):format(path:filename():string(), need)) + end +end +testIfExit(ROOT / 'test' / 'example' / 'vm.txt') +testIfExit(ROOT / 'test' / 'example' / 'largeGlobal.txt') -- cgit v1.2.3