It turned out this QC test is almost worthless because with the given
test case distribution the probability that the call to betweenLinesPS
succeeds is practically zero. One way to improve the test is to choose
characters from a (much) smaller set: with only ['a','b','\n'] allowed,
we have at least a 6% chance that the arbitrary start and end lines
actually appear (in order, i.e. first start, then end). This change
quickly uncovered actual bugs in the implementation! Indeed, if the
start or end line appears in the input but not as a complete line but
rather as the end of an existing line, betweenLinesPS fails instead of
searching further for a complete line.
|