To debug two buggy implementations of Swap_Substring.
Two students should work together at ONE workstation.
mkdir closed-lab05
cd closed-lab05
cp -R /class/sce/now/221/closed-labs/catalogs/closed-lab05/* .NOTE: The period . is part of the command. It denotes the current directory (folder).
ls -lYou should see something like the following:
total 8 drwx--S--- 2 long cisfact 512 May 5 16:40 buggy-1 drwx--S--- 2 long cisfact 512 May 5 16:40 buggy-2
There is a single bug in each of Buggy_1.cpp and Buggy_2.cpp. Your job is to locate and correct the bug in each. The tester-provided test cases from the warm-up exercise are your starting clues. You should first debug Buggy_1.cpp and then Buggy_2.cpp.
Buggy_1 < test-scriptin an xterm window. This will run Buggy_1, taking input from test-script and writing output to the monitor.
ERROR DETECTED:
expected // some value appears here
observed // a different value appears here
EXECUTION TERMINATING
Process shell finished
In this case
you have successfully debugged Buggy_1.cpp. Congratulations! -------------------------------------------------
| t1 = "Swap_It_Out"
| pos = 5
| len = 0
| t2 = ""
-------------------------------------------------
Swap_Substring (t1, pos, len, t2); |
-------------------------------------------------
| t1 = "Swap_?It_Out"
| pos = 5
| len = 0
| t2 = ""
-------------------------------------------------
ERROR DETECTED:
expected t1 = Swap_It_Out
observed t1 = Swap_?It_Out
EXECUTION TERMINATING
Process shell finished
In this case, there is still at least one bug in
Buggy_1.cpp, so you will need to try one more time to debug it.
Let the proctor know when you have successfully debugged both Buggy_1.cpp and Buggy_2.cpp. The proctor will check that your work is correct.