An important step in development was to be sure the replacement routines
were in all ways similar to the previous ones. For this reason, this piece
of code was written. One hands it two procedures (a reader and a writer)
and two file names (an input and an output). The tester will repeatedly
read an item with the reader and write it back with the writer.
|read-atom|, for instance, was tested on itself with
(test read-atom write "sources.s/newio.sw" "old")
(test @read-atom write "sources.s/newio.sw" "new")
(dos-call "" "fc old new || more")
(define (test reader writer in out)
(define (move i o)
(let ((a (reader i)))
(when (not (@eof-object? a))
(writer a o)
(move i o))))
(let ((i (open-input-file in))
(o (open-output-file out)))
(move i o)
(close-input-port i)
(close-output-port o)))