224 9.:3 Write a unit test
9.3
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
done.
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,
until done.
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-
gram text.
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.
9.3.2 Purpose
Determine whether a specific procedure is functioning as you expect it
should.
9.3.3
Questions answered
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?

Get Debugging by Thinking now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.