Computer Science 236

CS 236 Project Testing

We provide some example tests for each project as well as the tests we use to pass-off each project.

Please keep in mind that your project needs to pass all the tests on the lab machines where we run pass-offs. Your project may appear to produce the correct output for all the tests on another machine and not pass all the tests in the pass-off environment.


Project Tests


Project 1 Tests

Example Tests: project1-tests.zip
Pass-off Tests: project1-passoff.zip

Project 2 Tests

Example Tests: project2-tests.zip
Pass-off Tests: project2-passoff.zip

Project 3 Tests

Example Tests: project3-tests.zip
Pass-off Tests: project3-passoff.zip

Project 4 Tests

Example Tests: project4-tests.zip
Pass-off Tests: project4-passoff.zip

Project 5 Tests

Example Tests: project5-tests.zip
Pass-off Tests: project5-passoff.zip

How to Run a Group of Tests for a Project

Download and unpack the zip file. (Put the zip file inside the folder that contains your code.)

$ unzip project1-tests.zip

Use the script to run the tests.

$ sh run-tests.sh

How to Run an Individual Test

Consider test 10 for project 1. This test has an input file (in10.txt) and an expected-output file (out10.txt).

Run the test by giving the name of the executable file for the project, followed by the name of the test input file, and finally the name of the actual-output file. For example, the command for running test 10 on project 1 could look like this:

$ ./project1 in10.txt >actual.txt

When the program completes, the file 'actual.txt' will contain the actual output from the program.

Now you need to compare the expected output with the actual output to determine whether the program is working correctly. The linux 'diff' command is well suited for this purpose. You can run the 'diff' command with two filenames and it will report any differences between the two files. The 'diff' command gives no output when the files are the same. Run the 'diff' command like this:

$ diff out10.txt actual.txt

The file 'out10.txt' contains the expected output. The file 'actual.txt' contains the actual output. If the 'diff' command gives any output you need to modify the program so that the actual output matches the expected output. If the 'diff' command gives no output the program is working correctly for this test.