From 204ab9fba5a7a1e2e6981c11e0a6c67764332d21 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 10 Apr 2017 13:47:01 +0200 Subject: nan, -inf, inf --- tests/single.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/single.lua b/tests/single.lua index c770d22..c167196 100644 --- a/tests/single.lua +++ b/tests/single.lua @@ -271,17 +271,17 @@ do print("testing 'format %a %A'") assert(string.find(string.format("%A", 0.0), "^0X0%.?0?P%+?0$")) assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0?p%+?0$")) - -- if not _port then -- test inf, -inf, NaN, and -0.0 - -- assert(string.find(string.format("%a", 1/0), "^inf")) - -- assert(string.find(string.format("%A", -1/0), "^%-INF")) - -- assert(string.find(string.format("%a", 0/0), "^%-?nan")) - -- assert(string.find(string.format("%a", -0.0), "^%-0x0")) - -- end + if not _port then -- test inf, -inf, NaN, and -0.0 + assert(string.find(string.format("%a", 1/0), "^inf")) + assert(string.find(string.format("%A", -1/0), "^%-INF")) + assert(string.find(string.format("%a", 0/0), "^%-?nan")) + assert(string.find(string.format("%a", -0.0), "^%-0x0")) + end - -- if not pcall(string.format, "%.3a", 0) then - -- (Message or print)("\n >>> modifiers for format '%a' not available <<<\n") - -- else - -- assert(string.find(string.format("%+.2A", 12), "^%+0X%x%.%x0P%+?%d$")) - -- assert(string.find(string.format("%.4A", -12), "^%-0X%x%.%x000P%+?%d$")) - -- end + if not pcall(string.format, "%.3a", 0) then + (Message or print)("\n >>> modifiers for format '%a' not available <<<\n") + else + assert(string.find(string.format("%+.2A", 12), "^%+0X%x%.%x0P%+?%d$")) + assert(string.find(string.format("%.4A", -12), "^%-0X%x%.%x000P%+?%d$")) + end end -- cgit v1.2.3-70-g09d2