28538f8d9721d6b6503d16b4c6e7db1350cb7c53
braney
  Thu Sep 10 09:41:44 2026 -0700
lib/tests: add faSpeedReadTest, covering the FASTA read buffer growth, refs #38320

Eleven cases, each a set of line lengths. Each one writes a FASTA file,
reads it back with faMixedSpeedReadNext, and checks the name, the size,
every base and the terminating NUL.

The test frees the buffer before each case, so the growth starts from the
same place every time. That is what makes a shape reproduce a given sequence
of buffer sizes, and so what makes these shapes mean anything. Freeing also
means a write past the end of the buffer has to survive a free before the
next case can print.

The shapes are the one from the ticket, a variant whose overrun was small
enough to go unnoticed, the edges of the initial 65536 buffer, the first
doubling, a short line before a long one, a record spanning several
doublings, an evenly wrapped control, a single short line, and a two record
file so the second record is checked for anything the first left behind.

Against the code before the previous commit the test reports a short read
and differing bases on the first case, and exits non zero.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

diff --git src/lib/tests/expected/faSpeedReadTest src/lib/tests/expected/faSpeedReadTest
new file mode 100644
index 00000000000..6f4eec5b651
--- /dev/null
+++ src/lib/tests/expected/faSpeedReadTest
@@ -0,0 +1,24 @@
+ticket shape, three uneven lines
+  rec 0  lines 3  wrote 138586  read 138586  name rec0  ok
+same shape, overrun too small to abort
+  rec 0  lines 3  wrote 131239  read 131239  name rec0  ok
+one byte short of the initial size
+  rec 0  lines 2  wrote 65536  read 65536  name rec0  ok
+exactly the initial size
+  rec 0  lines 1  wrote 65536  read 65536  name rec0  ok
+one byte over the initial size
+  rec 0  lines 1  wrote 65537  read 65537  name rec0  ok
+crossing the first doubling
+  rec 0  lines 2  wrote 131073  read 131073  name rec0  ok
+short line then a long one
+  rec 0  lines 2  wrote 65536  read 65536  name rec0  ok
+several doublings in one record
+  rec 0  lines 3  wrote 340000  read 340000  name rec0  ok
+evenly wrapped, the ordinary case
+  rec 0  lines 4  wrote 200  read 200  name rec0  ok
+a single short line
+  rec 0  lines 1  wrote 12  read 12  name rec0  ok
+two records in one file
+  rec 0  lines 3  wrote 138586  read 138586  name rec0  ok
+  rec 1  lines 2  wrote 90300  read 90300  name rec1  ok
+11 cases, 0 problems