From 32c4759e6bda0296afaabcc8048e500e56c94bf8 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Sat, 27 Jun 2015 23:15:16 -0500 Subject: [PATCH] Add more basic number tests --- tests/jq.test | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/jq.test b/tests/jq.test index 2f843cf..cff817c 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1165,3 +1165,12 @@ try (1%.) catch . 1/0 jq: error: Division by zero? at , line 1: +# Basic numbers tests: integers, powers of two +[range(-52;52;1)] as $powers | [$powers[]|pow(2;.)|log2] == $powers +null +true + +[range(-99/2;99/2;1)] as $orig | [$orig[]|pow(2;.)|log2] as $back | ($orig|keys)[]|. as $k | (($orig|.[$k])-($back|.[$k]))|if . < 0 then . * -1 else . end|select(.>.00005) +null + + -- 2.40.0