How to Test the First 112 Assignment (see How to Test 112 Assignment for a more complete explanation of the testing method)
For p2 (and other assignments) you are required to write error messages
to standard error (using cerr << ). For assignments that
require error messages I will post an additional error output file:
example input: t01
example output: t01.out
example error output: t01.err
You can test your program as
follows:
$ movies < t01 > t01.myout 2> t01.myerr
$ diff t01.myout t01.out
$ diff t01.myerr t01.err
$
In this example I am assuming your program is named "movies" like the second assignment.
The first line runs the program movies reading from the file t01 (the
"<" redirects the file t01 into standard input), writing standard output to file
t01.myout (the ">" redirects the standard output to the file
t01.myout), and writing standard error to the file t01.myerr (the "2>" redirects the standard error to the file t01.myerr).
The second line compares the output from your program (t01.myout) with
my posted output (t01.out). The third line compares your error
output with my posted output (t01.err). If your two files
are identical to my two files you
have passed test t01.
The program diff looks for differences in files. If there are
differences it prints them. If there are no differences, it
doesn't print anything. Thus if you do the above for each test in the test directory, and
diff does not print anything, you pass all of my sample tests.
However, I will use tests that I
don't post to grade your program, so it is a good idea to develop some
of your own tests.
If you are programming using windows, every line in your program will
contain an extra hidden character (the DOS standard is different than
the Linux standard). I will only post Linux files. However,
you can convert your DOS files to Linux files using the command dos2unix.