Make tests pass when --disable-decnum

This commit is contained in:
Nicolas Williams authored and Nico Williams committed 2024-05-15 12:48:00 -05:00
1 parent c1276169d6
commit 6d02d53f51
8 files changed
+88 -37

No files matched your search

+7 -7
View File
@@ -1874,17 +1874,17 @@ map(. == 1)
# When no arithmetic is involved jq should preserve the literal value
.[0] | tostring
.[0] | tostring | . == if have_decnum then "13911860366432393" else "13911860366432392" end
[13911860366432393]
"13911860366432393"
true
.x | tojson
.x | tojson | . == if have_decnum then "13911860366432393" else "13911860366432392" end
{"x":13911860366432393}
"13911860366432393"
true
13911860366432393 == 13911860366432392
(13911860366432393 == 13911860366432392) | . == if have_decnum then false else true end
null
false
true
# Applying arithmetic to the value will truncate the result to double
@@ -1977,7 +1977,7 @@ tojson | fromjson
{"a":null}
# also "nan with payload" #2985
fromjson | isnan
if have_decnum then fromjson else nan end | isnan
"nan1234"
true
+6 -6
View File
@@ -6,21 +6,21 @@
0.12345678901234567890123456789
0.12345678901234567890123456789
[., tojson]
[., tojson] | . == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end
12345678909876543212345
[12345678909876543212345,"12345678909876543212345"]
true
. < 0.12345678901234567890123456788
0.12345678901234567890123456789
false
map([., . == 1]) | tojson
map([., . == 1]) | tojson | . == if have_decnum then "[[1,true],[1.000,true],[1.0,true],[1.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end
[1, 1.000, 1.0, 100e-2]
"[[1,true],[1.000,true],[1.0,true],[1.00,true]]"
true
. as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000)
. as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000) | . == if have_decnum then [true, false] else [false, false] end
10000000000000000000000000000001
[true, false]
true
.foo
{"foo": 42, "bar": "less interesting data"}
+4 -2
View File
@@ -668,9 +668,11 @@ if ! x=$($JQ -cn '[
fi
# CVE-2023-50268: No stack overflow comparing a nan with a large payload
$VALGRIND $Q $JQ '1 != .' <<\EOF >/dev/null
Nan4000
if $JQ -ne 'have_decnum'; then
$VALGRIND $Q $JQ '1 != .' <<\EOF >/dev/null
Nan4000
EOF
fi
# Allow passing the inline jq script before -- #2919
if ! r=$($JQ --args -rn -- '$ARGS.positional[0]' bar) || [ "$r" != bar ]; then