5.11. Load Test::Simple at run timeExample 5-16. examples/intro/t11_calc.t #!/usr/bin/perl
use strict;
use warnings;
my %tests = (
'1 + 1' => 2,
'2 + 2' => 4,
'2 + 2 + 2' => 6,
'1+1' => 2,
'0+ -1' => -1,
'0-1' => -1,
'-1+1' => 0,
);
require Test::Simple;
import Test::Simple tests => scalar keys %tests;
foreach my $t ( keys %tests ) {
ok( `./mycalc $t` == $tests{$t}, $t );
}
|