224 9.:3 Write a unit test
Read the control flow of a procedure or calling tree of the program
in a depth-first manner. Open a control-flow construct until it's
completely unfolded, and read the entire nested construct. Repeat
for each top-level nested construct, top to bottom, until done.
9 Use a class-hierarchy browser to do one of the following:
Review the inheritance hierarchy of the program in a breadth-first
manner. Open all the derived classes at the same nesting level,
review them top to bottom, and proceed to the next level until
Read the inheritance hierarchy of the program in a depth-first
manner. Open a base class until it's completely unfolded, and
review the hierarchy. Repeat for each base class, top to bottom,
9 Use a word processor that supports underlining and multiple text col-
ors to read the text and apply one of the refined tactics to the pro-
Write a unit test
9.3. I Basic tactic
Write a test that invokes a procedure in question and compares its result or
side effects with an expected result that is embedded in the test procedure.
Determine whether a specific procedure is functioning as you expect it
9 What inputs does a procedure accept?
9 What results does a procedure compute?
9 What side effects does a procedure cause?
9 What exceptions does a procedure activate?
9 What outputs does a procedure display?