-
Select a partner to work with on the closed lab exercise and decide whose
account to use for it. After you have completed the closed lab exercise,
the person whose account has been used may e-mail to his/her partner the
file(s) containing the solution that was devised by the partnership.
-
Copy the initial closed lab #7 files to your own working directory and get
into that directory:
cp -R /class/sce/now/222/closed-labs/closed-lab07/Closed_Lab07/ .
cd Closed_Lab07
-
If you haven't already done so, create a file called test-script that encodes
your test plan from the homework in the format expected by the Stack_Kernel
test
driver Stack_Test_Sample. If you have already done so, move or copy
the test plan file into your Closed_Lab07 directory, naming it test-script.
-
Run Stack_Test_Sample in that directory with input redirected from
your file called test-script and output redirected to another file
named correct-output, which will end up containing the output
produced by the test driver that uses a correct implementation of
Stack_Kernel. If you see no "violated assertion"
messages on the screen, then your test script is acceptable in the
sense that it uses the test driver and the Stack_Kernel
operations in a reasonable manner, and you may continue with the
next step. However, if you see any messages on the screen, then
you will need to edit your test script; perhaps you're calling a
Stack_Kernel operation with a violated precondition, or
perhaps you didn't provide enough parameter values for some
operation. Look at the file named correct-output and make sure the output is
what you expected!
-
Look
through the file
Stack_Test.cpp.
Read this program and understand it, then build the project. The file
should compile; but don't run the program until you've completed the next
step. (Stack_Test is identical to Stack_Test_Sample in its user interface,
but tests your implementation of Stack_Kernel -- and right
now your implementation is lacking bodies for some of the Stack_Kernel
operations!)
-
Edit the file CT/Stack/Kernel_1.h
to add the bodies of the operations you wrote for the homework. Once
Stack_Test.cpp compiles and links successfully, you may run it interactively
before proceeding to the next step.
-
In a terminal window and in your Closed_Lab07 directory, execute this command:
retest Stack_Test test-script correct-output
This will run your new version of Stack_Test, taking input from the
file test-script (and writing output of this run to the file test-script.out), and finally comparing test-script.out
to correct-ouput -- character for character. If there are no differences
between these two output files, then you will see nothing on the screen
except the next shell prompt; you didn't find a defect in this case.
However, if there is any difference between the two files, then you will
see some cryptic information that tells you which line numbers have differences.
Look at test-script.out and go to the first line number where there is
a difference. Inspect the output to see what's wrong, correct your
implementation, and repeat this step for the modified Kernel_3.h as
necessary.
Important note: Here again, it is the case that
different output than you get from the original Stack_Test_Sample is wrong
output! There are no operations of Stack_Kernel where two
different correct implementations may produce different answers.
So in this situation the retest command completely automates the testing
of your new implementation of Stack_Kernel.
-
Let your instructor know when you have identified and corrected all the
defects revealed by your test plan and you are confident that your implementation
of Stack_Kernel is correct, in order to get credit for this closed
lab.