So Let's Start From the Beginning
- We read Test::Tutorial, as recommended...
- ...and start with Test::Simple
- Enters MyMath.t
#!/usr/bin/perl -w
use strict;
use Test::Simple tests => 2; # <- Number of tests
use MyMath;
my @tests = (
[0 => 1],
[6 => 120],
);
foreach (@tests) {
my ($in, $out) = @$_;
# ok(boolean result, test description)
ok(MyMath::factorial($in) == $out, "$in! = $out");
}
$ MyMath.t
1..2
ok 1 - 0! = 1
not ok 2 - 6! = 120
# Failed test (MyMath.t1 at line 15)
# Looks like you failed 1 tests of 2.