diff options
Diffstat (limited to 'tests/fasta.cpp')
-rw-r--r-- | tests/fasta.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/fasta.cpp b/tests/fasta.cpp index 7954feef..35bd4425 100644 --- a/tests/fasta.cpp +++ b/tests/fasta.cpp @@ -7,6 +7,24 @@ #include <stdlib.h> #include <string.h> +// limit output, so we do not benchmark speed of printing +void puts_limited(char *x) +{ + static int left = 550; + int len = strlen(x); + if (len <= left) { + puts(x); + left -= len; + return; + } + if (left > 0) { + x[left] = '\0'; + puts(x); + x[left] = 'z'; + left = 0; + } +} + struct Random { enum { IM = 139968, IA = 3877, IC = 29573 }; Random() : last(42) {} @@ -68,7 +86,7 @@ struct LineBuffer { lastN = N + 1; return *this; } - void writeline() { puts(buffer); } + void writeline() { puts_limited(buffer); } protected: char buffer[lineLength + 2]; size_t lastN; @@ -87,7 +105,7 @@ struct RotatingString { memcpy(temp, buffer + pos, bytes); temp[bytes] = '\n'; temp[bytes] = '\0'; - puts(temp); + puts_limited(temp); delete temp; pos += bytes; if ( pos > size ) |