Developing, Testing, and Proving Correctness
Some possible exercises:
Given [correct] code, pre-/post-conditions; develop loop invariant
Given pre-/post-conditions, loop invariant; write code
Given pre-/post-conditions, code; find possible loop invariant and determine correctness
Given program; explore behavior in various circumstances
Given program; determine test plan and correctness
Given pre-/post-conditions; develop test plan
Given assignment and another student's solution; determine correctness
Sample Laboratory Exercise
Lab A on Invariants
Use
assert
statements in C++ to check loop invariants
Describe impact of order of execution on assertions, invariants
Develop loop invariants from code
Develop code from loop invariants
Lab B on Invariants
Use loop invariants to analyze correctness of existing code
Using loop invariants to find program errors (when they exist)
created May 4, 2003
last revised May 4, 2003
previous
next