CMPS-3350 Lab-12 - Midterm Coding Exam

Assignment: Write an automated unit-test.

Do your work in your Odin /3350/c folder.

Log on to Odin, then do this...
$ cd 3350 $ ./lab-start.sh $ cd c $ cp ../a/laba?.cpp exam12.cpp $ cp ../a/Makefile .
1. Start with your lab-10 program.
2. Replace laba?.cpp with your program name from lab-10.

Files to be collected:
----------------------
3350/c/exam12.cpp
3350/c/data12.txt
3350/c/Makefile

What to do...

Write a unit-test in your program.
1. Create your own small dictionary file. About 10 to 20 words. 2. Create a second executable file using your Makefile. This executable will perform your unit test. 3. Use this preprocessor directive to isolate your unit test components. #ifdef UNIT_TEST Do not put #define UNIT_TEST in your program code. 4. Your Unit-test executable will get the file-name from the command-line. 5. Your program output should show the following: 1. Known input words 2. Expected output words 3. Actual words output Sample output format of your Unit Test...
$ ./utest Program challenge number: N Find all words that have no duplicate letters. Unit test is running... ============================================== word input word output result ---------------- ----------- ------ hello good exam exam good goodbye goodbye error <----- classroom good c++ good coding coding good ============================================== Number of errors: 1 Unit test complete.
The data file for this test would look like this: hello no exam yes goodbye no classroom no c++ no coding yes