SWE 619 Assignment 4
Fall 2023
Goal:
Rep-Invariants, contracts, tests.
Consider Bloch's array-based, generic, mutable Stack
example.
Here's the code:
Stack.java
If you wish, you can ignore the
pushAll()
and
popAll()
methods in this assignment.
You can also ignore the suppression of compiler warnings.
- Develop a decent rep-invariant.
Hint: Your rep-invariant should definitely consider what values
are allowed in various parts of the array.
- Implement
repOk()
.
- Introduce a fault (i.e. "bug") that breaks the rep-invariant.
Try to do this with a small (conceptual) change to the code.
Show that the rep-invariant is broken with a JUnit test.
-
Analyzed your bug with respect to the contracts of other methods
in the Stack class. Does your invariant-breaking bug affect the
correctness argument for any of these methods?
-
Do you think your fault is realistic? Why or why not?
As in assignment 3, your deliverable is a story,
with exactly the same rationale.
Take screenshots (e.g. of failing JUnit tests)
as necessary to make your case.
Grading:
- Correctness of solution
- Clarity of story