File: intersection.t

package info (click to toggle)
libset-object-perl 1.42-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 620 kB
  • sloc: perl: 1,069; makefile: 14
file content (88 lines) | stat: -rw-r--r-- 1,507 bytes parent folder | download | duplicates (9)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

use Set::Object;
print "1..20\n";

my $a = Set::Object->new("a".."e");
my $b = Set::Object->new("c".."g");

my $d = $a->intersection($b);

Set::Object->as_string_callback(sub { my $self = shift; "(".join(" ", sort $self->members).")" });

print "not " unless $d eq "(c d e)";
print "ok 1\n";

print "not " unless $a eq "(a b c d e)";
print "ok 2\n";

print "not " unless $b eq "(c d e f g)";
print "ok 3\n";

my $e = $a * $b;

print "not " unless $e eq "(c d e)";
print "ok 4\n";

print "not " unless $a eq "(a b c d e)";
print "ok 5\n";

print "not " unless $b eq "(c d e f g)";
print "ok 6\n";

my $f = $b->intersection($a);

print "not " unless $f eq "(c d e)";
print "ok 7\n";

print "not " unless $a eq "(a b c d e)";
print "ok 8\n";

print "not " unless $b eq "(c d e f g)";
print "ok 9\n";

my $g = $b * $a;

print "not " unless $g eq "(c d e)";
print "ok 10\n";

print "not " unless $a eq "(a b c d e)";
print "ok 11\n";

print "not " unless $b eq "(c d e f g)";
print "ok 12\n";

my $h = $a * "x";

print "not " unless $h eq "()";
print "ok 13\n";

print "not " unless $a eq "(a b c d e)";
print "ok 14\n";

my $i = "y" * $a;

print "not " unless $i eq "()";
print "ok 15\n";

print "not " unless $a eq "(a b c d e)";
print "ok 16\n";

my $j = $a * "c";

print "not " unless $j eq "(c)";
print "ok 17\n";

print "not " unless $a eq "(a b c d e)";
print "ok 18\n";

my $k = "e" * $a;

print "not " unless $k eq "(e)";
print "ok 19\n";

print "not " unless $a eq "(a b c d e)";
print "ok 20\n";