Test with expected results

We should write the expected value next to the actual result:

In order to make it obvious what are the expected values first we have to compute them ourself - or bring in the expert, or the client who knows what she expects from the application to display - and make sure the expected values are always written next to the actual results.

That way it will be obvious to any tester what values need to be compared.

use strict;
use warnings;

use FindBin qw($Bin);
use lib "$Bin/../lib";
use MySimpleCalc qw(sum);

print sum(1, 1),    "  2\n";
print sum(2, 2),    "  4\n";
print sum(2, 2, 2), "  6\n";


2  2
4  4
4  6

Now it is better.