You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

7.11. More than one test

We can then setup lot's of tests and run them through one invocation of bc.

Example 7-5. examples/bc/bc5.pl

#!/usr/bin/perl
use strict;
use warnings;

use Expect;
use Test::More qw(no_plan);
$Expect::Log_Stdout = 0;

my @sets = (
    [23+7,     30],
    ['23+7',   30],
    ['11+1',   10],
    ['2*21',   42],
);
 
my $e = Expect->new;
$e->spawn("bc") or die "Could not start bc\n";
$e->expect(undef, "warranty") or die "no warranty\n";

foreach my $set (@sets) {
    $e->send("$$set[0]\n");
    ok($e->expect(1, $$set[1]), $$set[0]);
}
$e->send("quit\n");

If you are interested in on-site trainings by the author, please contact me directly.