File: subclass.t

package info (click to toggle)
libset-intspan-perl 1.19-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 224 kB
  • sloc: perl: 1,236; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 961 bytes parent folder | download | duplicates (3)
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;
}