#!/usr/bin/perl -w use strict; use Test::Simple tests => 2; use MyMath; my @tests = ( [0 => 1], [6 => 120], ); foreach (@tests) { my ($in, $out) = @$_; my $res = MyMath::factorial($in); # more verbosity ok($res == $out, "factorial($in) gave $res, expected $out"); }
$ MyMath.t 1..2 ok 1 - factorial(0) gave 1, expected 1 not ok 2 - factorial(6) gave 720, expected 120 # Failed test (MyMath.t2 at line 16) # Looks like you failed 1 tests of 2.