Test::More is( value, expected_value, name);
- is
It would be much better to see the expected value and the actually received value. This usually helps in locating the problem.
use strict;
use warnings;
use lib 'lib';
use MySimpleCalc qw(sum);
use Test::More tests => 3;
is(sum(1, 1), 2, '1+1' );
is(sum(2, 2), 4, '2+2' );
is(sum(2, 2, 2), 6, '2+2+2' );
perl t/32.t
1..3
ok 1 - 1+1
ok 2 - 2+2
not ok 3 - 2+2+2
# Failed test '2+2+2'
# at t/32.t line 11.
# got: '4'
# expected: '6'
# Looks like you failed 1 test of 3.
See, in this case we can already guess that it cannot add 3 values.
is
compares usingeq