From 3e90f68b2536d3bff1029c4f022b9f098024249e Mon Sep 17 00:00:00 2001 From: Clarence Risher Date: Sun, 15 Sep 2024 10:16:42 -0400 Subject: [PATCH] Use string.format to fix floating point error in test output --- changelog.md | 1 + test/full/projects.lua | 2 +- test/full/self.lua | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 88ad52cc7..5c6956f6d 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ## Unreleased * `NEW` Added support for Japanese locale +* `FIX` Eliminate floating point error in test benchmark output ## 3.10.6 `2024-9-10` diff --git a/test/full/projects.lua b/test/full/projects.lua index 22b27443e..d10158bc7 100644 --- a/test/full/projects.lua +++ b/test/full/projects.lua @@ -49,7 +49,7 @@ local function doProjects(pathname) for uri in files.eachFile() do local fileClock = os.clock() diag.doDiagnostic(uri, true) - print('诊断文件耗时:', os.clock() - fileClock, uri) + print('诊断文件耗时:', string.format("%.6f", os.clock() - fileClock), uri) end local passed = os.clock() - clock diff --git a/test/full/self.lua b/test/full/self.lua index 69da54a05..e5099dd2c 100644 --- a/test/full/self.lua +++ b/test/full/self.lua @@ -48,7 +48,7 @@ for uri in files.eachFile() do end) local fileClock = os.clock() diag.doDiagnostic(uri, true) - print('诊断文件耗时:', os.clock() - fileClock, uri) + print('诊断文件耗时:', string.format("%.6f", os.clock() - fileClock), uri) ::CONTINUE:: end