1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
# -*- perl -*-
use strict;
use Set::IntSpan 1.17;
@Foo::Bar::ISA = qw(Set::IntSpan);
my $N = 1;
sub Not { print "not " }
sub OK { print "ok ", $N++, "\n" }
print "1..20\n";
my $intspan = new Set::IntSpan '15-25';
my $foobar = new Foo::Bar '1-10, 20-30';
ref $intspan eq 'Set::IntSpan' or Not; OK;
ref $foobar eq 'Foo::Bar' or Not; OK;
for my $op (qw(union intersect diff xor))
{
my $result;
$result = $intspan->$op($intspan);
ref $result eq 'Set::IntSpan' or Not; OK;
$result = $intspan->$op($foobar);
ref $result eq 'Set::IntSpan' or Not; OK;
$result = $foobar->$op($intspan);
ref $result eq 'Foo::Bar' or Not; OK;
$result = $foobar->$op($foobar);
ref $result eq 'Foo::Bar' or Not; OK;
}
for my $op (qw(complement))
{
my $result;
$result = $intspan->$op();
ref $result eq 'Set::IntSpan' or Not; OK;
$result = $foobar->$op();
ref $result eq 'Foo::Bar' or Not; OK;
}
|