summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-01-22 11:13:16 +0000
committerPádraig Brady <P@draigBrady.com>2013-01-26 02:37:13 +0000
commit2238ab574191d30b89a007b760c616efaf9c219c (patch)
tree289b6fe06491cb9c30ceac15d607985c07d0981c /tests/misc
parent326e5855bc8dd3d0c5b2c0e461c65879d2b5694d (diff)
downloadcoreutils-2238ab574191d30b89a007b760c616efaf9c219c.tar.xz
seq: fix to always honor the step value
* src/seq.c (main): With 3 positive integer args we were checking the end value was == "1", rather than the step value. * tests/misc/seq.pl: Add tests for this case. Reported by Marcel Böhme in http://bugs.gnu.org/13525
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/seq.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/misc/seq.pl b/tests/misc/seq.pl
index 64c62b2bc..b3496d62c 100755
--- a/tests/misc/seq.pl
+++ b/tests/misc/seq.pl
@@ -137,6 +137,17 @@ my @Tests =
['sep-1', qw(-s, 1 3), {OUT => [qw(1,2,3)]}],
['sep-2', qw(-s, 1 1), {OUT => [qw(1)]}],
['sep-3', qw(-s,, 1 3), {OUT => [qw(1,,2,,3)]}],
+
+ # Exercise fast path avoidance logic.
+ # In 8.20 a step value != 1, with positive integer start and end was broken
+ ['not-fast-1', qw(1 3 1), {OUT => [qw(1)]}],
+ ['not-fast-2', qw(1 1 4.2), {OUT => [qw(1 2 3 4)]}],
+ ['not-fast-3', qw(1 1 0)],
+
+ # Ensure the correct parameters are passed to the fast path
+ ['fast-1', qw(4), {OUT => [qw(1 2 3 4)]}],
+ ['fast-2', qw(1 4), {OUT => [qw(1 2 3 4)]}],
+ ['fast-3', qw(1 1 4), {OUT => [qw(1 2 3 4)]}],
);
# Append a newline to each entry in the OUT array.