test "suite", end-of-dataset corner case

These changes add some basic testing and address a bug where spurious records can get read in at the end of a dataset.

Yours, Mike Macpherson