diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-06-23 22:51:24 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-06-24 17:04:01 +0100 |
commit | 32c97093db85c827ccbbf4cd4255190718863232 (patch) | |
tree | c0fc83e1aeb1ef93ae4327d48beb1637177c22a5 /tests/misc | |
parent | 60c8e31d9201f10295cfdcfd2d15893f9682083b (diff) | |
download | coreutils-32c97093db85c827ccbbf4cd4255190718863232.tar.xz |
seq: handle exponents more consistently
src/seq.c (scan_arg): Set precision and width _after_ exponentiation.
For example, this will make '1.1e1 12' and '11 1.2e1' equivalent.
One can still set the precision by specifying extra precision on
the start value, or more naturally with a precision on a step value.
* tests/misc/seq-precision.sh: Add new cases.
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/seq-precision.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/misc/seq-precision.sh b/tests/misc/seq-precision.sh index e6a2bd7b8..b8382ca19 100755 --- a/tests/misc/seq-precision.sh +++ b/tests/misc/seq-precision.sh @@ -58,4 +58,22 @@ seq 1 .1 0x2 | head -n2 > out || fail=1 printf "%s\n" 1.0 1.1 > exp || framework_failure_ compare exp out || fail=1 +# Ensure consistent handling of precision/width for exponents + +seq 1.1e1 12 > out || fail=1 +printf "%s\n" 11 12 > exp || framework_failure_ +compare exp out || fail=1 + +seq 11 1.2e1 > out || fail=1 +printf "%s\n" 11 12 > exp || framework_failure_ +compare exp out || fail=1 + +seq -w 1.1e4 | head -n1 > out || fail=1 +printf "%s\n" 00001 > exp || framework_failure_ +compare exp out || fail=1 + +seq -w 1.10000e5 1.10000e5 > out || fail=1 +printf "%s\n" 110000 > exp || framework_failure_ +compare exp out || fail=1 + Exit $fail |