CSC 101 Program 2 Part A, Test Plan

This is a test plan for Programming Assignment 2, Part A. As with Program 1, this Program 2A test plan consists of test cases, each one of which runs the make_change2 program with different inputs. For example, the 26th test case runs the program with the sample inputs shown in the Program 2, Part A writeup. These inputs are a purchase amount of of $22.16 and an amount tendered of $100.

For Part A of this assignment, the program being tested must be named "make_change2". You make this program with the compiler command

gcc -ansi -pedantic -Wall -Werror make_change2.c -o make_change2
as described in the writeup.

There is an executable testing script named run.csh. This script implements the test plan defined in the table below. This is the script that will be run on your submitted program to compute your score.

It is strongly recommended that you run this script yourself, before submitting your program. To do so, you need a copy of the script itself, as well as a complete copy of both the inputs and expected-output testing directories. To obtain all of the testing files, run the following UNIX commands from the directory where you've stored your executable make_change2 program:

cp -rp ~gfisher/classes/101/programs/2/testing_a .
cd testing_a
./run.csh
Note that you only need to run the "cp -rp ..." command one time, not every time you want to test your program.

A two-part name is used for the testing files, corresponding to the two program inputs for each test case. For example, the file input/2.16,5.00 has the inputs for the first test case. The same file name is used in all of the testing sub-directories:

Before your programs runs, both the output and diffs directories will be empty. After your program runs, the output directory will have one file for each test case run through your program.

If your make_change2 program passes all of the test cases, the only terminal output you will see is the score, which will be "100/100" points. If one or more cases fail, the script will report the failure(s), and print the appropriate score at the end. The difference files in the diffs directory show the details of how your output differs from the expected output. The testing script uses the UNIX diff utility to compare expected and actual output files. An explanation of how to read UNIX diff files is available at http://www.gnu.org/software/diffutils/manual/diffutils.html#Comparison

The complete test plan has 63 test cases. Each test case is worth 1.5873015873015872 points, for a total of 100 points possible. OK, to be serious, each test case is weighted equally out of 100 points possible, meaning each case is worth about 1.5 points. When your score is computed, the run script will do the necessary arithmetic, and round up to the nearest points.

The following table describes what each test case is for.

Test
Case
Input:
  purchased,tendered
Correct
  Output
Description
  of Test Case
1 2.16,5.00 expected-output/
2.16,5.00
Sample used in the program 1 writeup.
2 0,0 expected-output/
0,0
Empty case -- nothing purchased, no change
3 0,1 expected-output/
0,1
Free case -- $1 purchase, everything back in change
4 1,1 expected-output/
1,1
No change case -- $1 purchase, $1 tendered
5 .01,1 expected-output/
.01,1
Max change for $1 purchase
6 .99,1 expected-output/
.99,1
Min change for $1 purchase
7 .01,5 expected-output/
.01,5
Max change for $5 purchase
8 4.99,5 expected-output/
4.99,5
Min change for $5 purchase
9 .81,5 expected-output/
.81,5
Everything but quarters, with $5 purchace
10 .69,5 expected-output/
.69,5
Everything but dimes, with $5 purchace
11 .36,5 expected-output/
.36,5
Everything but nickels, with $5 purchace
12 .6,5 expected-output/
.6,5
Everything but pennies, with $5 purchace
13 .57,5 expected-output/
.57,5
14 .09,.10 expected-output/
.09,.10
1 penny in change, 0 for all other denominations, typical case
15 .95,1 expected-output/
.95,1
1 nickel in change, 0 for all other denominations, typical case
16 .40,.50 expected-output/
.40,.50
1 dime in change, 0 for all other denominations, typical case
17 .75,1.00 expected-output/
.75,1.00
1 quarter in change, 0 for all other denominations, typical case
18 4,5 expected-output/
4,5
1 dollar in change, 0 for all other denominations, typical case
19 .01,.02 expected-output/
.01,.02
1 penny in change, 0 for all other denominations, dumb customer
20 .10,.15 expected-output/
.10,.15
1 nickel in change, 0 for all other denominations, dumb customer
21 .10,.20 expected-output/
.10,.20
1 dime in change, 0 for all other denominations, dumb customer
22 .50,.75 expected-output/
.50,.75
1 quarter in change, 0 for all other denominations, dumb customer
23 1,2 expected-output/
1,2
1 dollar in change, 0 for all other denominations, dumb customer
24 .01,100000 expected-output/
.01,100000
Max change from a $100,000 dollar bill
25 99999.99,100000 expected-output/
99999.99,100000
Min change from a $100,000 dollar bill
26 22.16,100 expected-output/
22.16,100
Sample used in the program 1 writeup.
27 0.0,0 expected-output/
0.0,0
Empty case -- nothing purchased, no change
28 0.0,50 expected-output/
0.0,50
Free case -- $50 purchase, everything back in change
29 1,50 expected-output/
1,50
No change case -- $50 purchase, $50 tendered
30 .01,50 expected-output/
.01,50
Max change for $50 purchase
31 .99,50 expected-output/
.99,50
Min change for $50 purchase
32 .01,100 expected-output/
.01,100
Max change for $100 purchase
33 99.99,100 expected-output/
99.99,100
Min change for $100 purchase
34 41.57,60 expected-output/
41.57,60
Everything but twenties, with $60 purchace
35 31.57,60 expected-output/
31.57,60
Everything but tens, with $60 purchace
36 5.57,60 expected-output/
5.57,60
Everything but fives, with $60 purchace
37 4.57,60 expected-output/
4.57,60
Everything but dollars, with $60 purchace
38 .81,60 expected-output/
.81,60
Everything but quarters, with $60 purchace
39 .69,60 expected-output/
.69,60
Everything but dimes, with $60 purchace
40 .36,60 expected-output/
.36,60
Everything but nickels, with $60 purchace
41 .6,60 expected-output/
.6,60
Everything but pennies, with $60 purchace
42 .57,60 expected-output/
.57,60
Some of each, with $60 purchace
43 0.09,.10 expected-output/
0.09,.10
1 penny in change, 0 for all other denominations, typical case
44 0.95,1 expected-output/
0.95,1
1 nickel in change, 0 for all other denominations, typical case
45 0.40,.50 expected-output/
0.40,.50
1 dime in change, 0 for all other denominations, typical case
46 0.75,1.00 expected-output/
0.75,1.00
1 quarter in change, 0 for all other denominations, typical case
47 4.00,5 expected-output/
4.00,5
1 dollar in change, 0 for all other denominations, typical case
48 5.00,10 expected-output/
5.00,10
1 five in change, 0 for all other denominations, typical case
49 10.00,20 expected-output/
10.00,20
1 ten in change, 0 for all other denominations, typical case
50 30.00,50 expected-output/
30.00,50
1 twenty in change, 0 for all other denominations, typical case
51 0.01,.02 expected-output/
0.01,.02
1 penny in change, 0 for all other denominations, dumb customer
52 0.10,.15 expected-output/
0.10,.15
1 nickel in change, 0 for all other denominations, dumb customer
53 0.10,.20 expected-output/
0.10,.20
1 dime in change, 0 for all other denominations, dumb customer
54 0.50,.75 expected-output/
0.50,.75
1 quarter in change, 0 for all other denominations, dumb customer
55 1.0,2 expected-output/
1.0,2
1 dollar in change, 0 for all other denominations, dumb customer
56 10.00,15 expected-output/
10.00,15
1 five in change, 0 for all other denominations, typical case
57 20.00,30 expected-output/
20.00,30
1 ten in change, 0 for all other denominations, typical case
58 20.00,40 expected-output/
20.00,40
1 twenty in change, 0 for all other denominations, typical case
59 0.01,100000 expected-output/
0.01,100000
Max change from a $100,000 dollar bill (again)
60 99999.99,100000.00 expected-output/
99999.99,100000.00
Min change from a $100,000 dollar bill (again)
61 -5,0 expected-output/
-5,0
Error for negative purchase amount
62 5,-1 expected-output/
5,-1
Error for negative tendered amount
63 105,100 expected-output/
105,100
Error for insuffcient funds