|
Testing and Debugging Conditionals
|
|
Prof. David Bernstein
|
| Computer Science Department |
| bernstdh@jmu.edu |
= instead of
==
== instead of
.equals() with reference types== with floating point
numbers
An Example:
Test cases: 50 100 150 200 300 1000
An Example:
Test cases: -1.0 0.0 10000.0 20000.0 20001.0
An Example of a Compound Condition:
Test cases:
70, 'M'
70, 'F'
62, 'M'
62, 'F'
50, 'M'
50, 'F'
An Example of Nested Conditions:
Test cases:
70, 'M'
70, 'F'
62, 'M'
62, 'F'
50, 'M'
50, 'F'
print() calls before, inside,
and after the conditional statementsprint() calls that check
for "accidental assignments" (i.e., use
of the = operator instead of the
== operator)