| Prev | Testing and Code Coverage | Next |
my $input = int shift;
my @squares = (0, 1, 5, 9);
if ($input < 4 && $input > -4)
{
print $squares[abs $input];
}
Full coverage with input of -4, 0 and 4
What's two squared?
Check each value is read
Lookup table and tests get values from same source
| Slide 61 | YAPC::Europe::2002 | Copyright © 2002 Paul Johnson |