Write a separate test suite (test harness, test framework)
for your library -- a complete Modula-2 program module that imports from
your library. This program should produce 1,000 random CARDINALS
between 0 and 9,999 and save them into a file of the user's choosing.
The numbers should be formatted ten per row, in columns: e.g.,
9472 3930 4876 239 1029 12 7349 1920 0 2382
3390 1528 3 5867 9999 8821 2002 77 1103 902
....
Here's one possible implementation of the test suite:
MODULE PseudoRandomTest;
FROM STextIO IMPORT
WriteString, WriteLn;
FROM SWholeIO IMPORT
WriteCard;
FROM RedirStdIO IMPORT
OpenOutput, CloseOutput;
FROM PseudoRandom IMPORT
Random;
VAR
row, col : CARDINAL;
BEGIN
WriteString ("This program will output 1,000 random numbers between ");
WriteString ("0 and 9999 to a file of your choosing.");
WriteLn;
WriteString ("Please select a file in the popup window.");
WriteLn;
OpenOutput;
FOR row := 1 TO 100
DO
FOR col := 1 TO 10
DO
WriteCard (TRUNC (10000.0 * Random()), 5);
END;
WriteLn;
END;
CloseOutput;
WriteString ("All done!");
WriteLn;
END PseudoRandomTest.