A Must Have
#!/usr/bin/perl -w
use strict;
use Acme::Test qw(MyMath); # <- ESSENTIAL
exit; # <-
use Test::More;
# A whole heap of tests that fail
my @tests = (
[0 => "ah"],
[5 => "oh"],
[6 => "uh"],
);
plan tests => scalar(@tests) + 1;
require_ok("MyMath");
foreach (@tests) {
my ($in, $out) = @$_;
my $res = MyMath::factorial($in);
is($res, $out, "factorial($in)") or diag ("gave $res, expected $out");
}
$ MyMath.t
# Testing MyMath
# [Public] Testing subroutine MyMath::factorial()
ok 1 - factorial() passed expected parameters
ok 2 - factorial() catches faulty input
ok 3 - factorial() works as expected with no input
ok 4 - factorial() return value OK
1..4