1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

seq: Add a print_seq fast path function for integer and positive increments

A lot of custom logic, we basically do arithmetic on character
arrays, but this comes at with huge performance gains.

Unlike coreutils `seq`, we do this for all positive increments
(because why not), and we do not fall back to slow path if
the last parameter is in scientific notation.

Also, add some tests for empty separator, as that may catch
some corner cases.
This commit is contained in:
Nicolas Boichat 2025-03-24 17:46:40 +01:00
parent b5e0e2342b
commit 560d1eb1b7
4 changed files with 239 additions and 3 deletions

View file

@ -216,6 +216,10 @@ fn test_separator_and_terminator() {
.args(&["-s", ",", "2", "6"])
.succeeds()
.stdout_is("2,3,4,5,6\n");
new_ucmd!()
.args(&["-s", "", "2", "6"])
.succeeds()
.stdout_is("23456\n");
new_ucmd!()
.args(&["-s", "\n", "2", "6"])
.succeeds()
@ -286,6 +290,10 @@ fn test_separator_and_terminator_floats() {
.args(&["-s", ",", "-t", "!", "2.0", "6"])
.succeeds()
.stdout_is("2.0,3.0,4.0,5.0,6.0!");
new_ucmd!()
.args(&["-s", "", "-t", "!", "2.0", "6"])
.succeeds()
.stdout_is("2.03.04.05.06.0!");
}
#[test]