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 (36 lines) | stat: -rw-r--r-- 845 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
use Set::Object;

require './t/object/Person.pm';
package Person;

populate();

$bart = $bart;
$marge = $marge;

$kids = Set::Object->new($bart, $lisa, $maggie);
$females = Set::Object->new($marge, $lisa, $maggie);
$babies = Set::Object->new($maggie);

print "1..6\n";

print 'not ' unless $kids->intersection($females) == Set::Object->new($lisa, $maggie);
print "ok 1\n";

print 'not ' unless $kids->intersection($females, $babies) == Set::Object->new($maggie);
print "ok 2\n";

print 'not ' unless $kids * $females == Set::Object->new($lisa, $maggie);
print "ok 3\n";

print 'not ' unless $kids * $females == $females * $kids;
print "ok 4\n";

print 'not ' unless $kids * $kids == $kids;
print "ok 5\n";

print 'not ' unless ($kids * Set::Object->new())->size == 0;
print "ok 6\n";

print "# size = ".($kids * Set::Object->new())->size."\n";