diff options
author | Nicolas Williams <nico@cryptonector.com> | 2015-06-27 23:15:16 -0500 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2015-06-27 23:15:16 -0500 |
commit | 32c4759e6bda0296afaabcc8048e500e56c94bf8 (patch) | |
tree | bfa569545c5dcf99216715c0970168eaaadf9e54 | |
parent | 6366cfd7a4275a25e128cc55f4c24a4079bc7005 (diff) |
Add more basic number tests
-rw-r--r-- | tests/jq.test | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test index 2f843cf5..cff817cf 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1165,3 +1165,12 @@ try (1%.) catch . 1/0 jq: error: Division by zero? at <top-level>, 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 + + |