#!/usr/bin/perl -w use strict; use Test::More; my @tests = ( [0 => 1], [5 => 120], [6 => 720], ); plan tests => scalar(@tests) + 1; # +1 for require_ok() require_ok("MyMath"); foreach (@tests) { my ($in, $out) = @$_; my $res = MyMath::factorial($in); is($res, $out, "factorial($in)") or diag ("gave $res, expected $out"); }