labs
This is an old revision of the document!
Weekly Lab Exercises
Week 2 (May 28)
-
- After following the video, you are asked to complete the contracts, implementations, and tests for both BOOK and GENERIC_BOOK classes.
- You are also asked to try with all the four possible implementations for the mappings between names and records.
Week 1 (May 21)
Exercise 1 (follow closely with the slides):
- Launch Eiffel Studio (estudio15.01 &)
- Create an empty project named bank
- Add the espec library from the project setting
- From the clusters explorer, add a new class ACCOUNT
- Copy from slides 15 and 16 the code of ACCOUNT to begin with
- From the clusters explorer, add a new class TEST_ACOUNT
- Choose ES_TEST as the parent of this class
- Copy from slide 23 the code of TEST_ACCOUNT to begin with
- Add Boolean queries test_create_account (slide 10), test_withdraw (slide slide 11), test_withdraw2 (slide 19), and procedure test_withdraw3 (slide 22) to class TEST_ACCOUNT
- Add these queries and procedures as test cases as shown in slide 23
- Launch the tests (click on the small down arrow to the right of the Run button, then choose Run Workbench System)
- If the tests fail, set break points and debug, and rerun the tests.
- Follow the rest of slides to gradually add the TRANSACTION class and new features to the ACCOUNT class.
Exercise 2:
- Download and unzip a version of the bank project.
- Compile the project.
- Run Workbench System (described above)
- All tests should fail!
- This is because the implementation and contracts (pre- and post-condition, and invariants) are missing.
- Complete all the missing implementations and contracts.
- Use breakpoints and the debugger to identify the bugs, if any.
- Repeat until you can pass all tests.
labs.1432980881.txt.gz · Last modified: 2015/05/30 10:14 by jackie