CSE 222 Closed Lab #4


Please follow these steps in closed lab:

  1. 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 which was devised by the partnership.
  2. Copy the initial closed lab #4 files to your own working directory and get into that directory:
    cp -R /class/sce/now/222/closed-labs/closed-lab04/Closed_Lab04/ .
    cd Closed_Lab04
  3. 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 Sequence_Kernel test driver Sequence_Test_Sample.  If you have already done so, move or copy the test plan file into your Closed_Lab04 directory, naming it test-script.
  4. Run Sequence_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 Sequence_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 Sequence_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 Sequence_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!
  5. Look through the file Sequence_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.  (Sequence_Test is identical to Sequence_Test_Sample in its user interface, but the former tests your implementation of Sequence_Kernel -- and right now your implementation is lacking bodies for some of the Sequence_Kernel operations!)
  6. Edit the file CT/Sequence/Kernel_3.h to add the bodies of the operations you wrote for the homework.  Once Sequence_Test.cpp compiles and links successfully, you may wish to run it interactively before proceeding to the next step.
  7. In a terminal window and in your Closed_Lab04 directory, execute this command:
    retest Sequence_Test test-script correct-output
    This will run your new version of Sequence_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: In this case, different output than you get from Sequence_Test_Sample is wrong output!  There are no operations of Sequence_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 Sequence_Kernel.  But if you were testing Set_Kernel or Partial_Map_Kernel, completely automated testing merely by comparing two output files character for character would not work.  Why?  Would it allow defective implementations to get by, or would it flag possibly correct implementations as defective?

  8. 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 Sequence_Kernel is correct, in order to get credit for this closed lab.