Example 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 );
}
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| Enlarge our test suit | Up | Forget about your "plan", use "no_plan" |