Testing - the Program
CS 330 - Fall 2004 - Ms. Katz

Goals
- to practice your software development techniques
- to practice C++ and using libraries
- to practice finding information on your own
- to build a program with multiple files
- to substantially modify an existing program to suit your needs

Overview
For this assignment, you will develop the Testing program. Refer to the problem description and input and output specifications in another handout. Those specifications must be met. This handout gives other requirements for the delivered program.

This assignment is due Tuesday, October 5th at 11pm. The first test for this course will be on October 7th, so that's a firm due date. I will be unavailable the preceding weekend and much of that day. You may want to consider September 30th as the due date. Realize that you will have other assignments to complete in this time frame. Plan accordingly. Early delivery is good.

Requirements
Your program must be in C++. It should follow your design but need not match it exactly. It should compile and execute cleanly on the C++ compiler on our Linux system. It must use appropriate functions extensively, and those functions must use parameters passed appropriately. The functions should have high cohesion and low coupling.

You should build this program with several files with either .h or .cxx endings. All the files in the project directory should compile together into one program when I build it on cs with
  g++ -Wall *.cxx

Your C++ program should take three arguments on the command line. The first is the name of an executable file. The second is the name of an input directory which contains several files each containing input for one test case. The third is the name of an expected output directory containing files with names corresponding to the input files. Each expected output file contains the output expected when executing the program to be tested with the input file contents.

These file names will be provided on the command line. Do not ask for them. I'm providing the code to read the command line in my main.cxx as well as main.cxx.alt

Your program should use classes from the C++ Standard Template Library (STL) appropriately. For example, you should not implement a vector class yourself.

I'm providing you with testing.h which contains the prototypes for functions used outside their defining files. I'm also providing support.cxx which is the implementation of most of those functions. These functions will help you do some of the file processing and program execution tasks. You may modify them to suit your purposes. They are examples. They compile together and work to run the executable file on the contents of one input file. They also list the names of the input files.

However, when I started to write the program corresponding to my dataflow diagram, I took a different approach. The main program I used is streamlined, and the majority of the program logic is in another file that I'm not giving you. However, you may see my main function in main.cxx.alt where you'll see that I don't mention vectors or even many strings or files.

Your program should be appropriately commented and indented. You should test it to find bugs before I find them. It should be modifiable and flexible. Just having the program execute cleanly does not assure an 'A' grade.

If you have questions about the problem, ask me.

Submit it as the testing assignment. Multiple submissions are acceptable until the due date but don't overdo it.

Sample Output
This is the text of a run of my program. Yours will probably vary.

Will run square
Input will come from sqInput
Expected output is in sqOutput
Input files: negThree two four zero 

**** Running test negThree ****
Output differs with '-3' instead of expected '9'
negThree failed

**** Running test two ****
two is okay

**** Running test four ****
four is okay

**** Running test zero ****
Output differs with '42' instead of expected '0'
zero failed

Hints
In comparing the two output files, you'll use a file stream handle for each file. Read into two strings and compare their contents. Think simple.

Build this project incrementally so that you always have something working. Make backups before big changes.

Sometime this week copy the files I'm giving you and build your test case so that you see the list of input files when you run my program.

If you have questions, ask me.