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