File: union.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 (28 lines) | stat: -rw-r--r-- 778 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
use strict;
use warnings;
use Set::Object;
use Test::More tests => 10;

my (@simpsons, $homer, $marge, $bart, $lisa, $maggie, $patty, $selma);

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

populate();

foreach my $class ( qw(Set::Object Set::Object::Weak) ) {
  my $simpsons = $class->new($homer, $marge);
  my $bouviers = $class->new($marge, $patty, $selma);
  my $both = $class->new($homer, $marge, $patty, $selma);
  my $empty = $class->new;

  ::ok( $simpsons->union($bouviers) == $both, "union method" );

  ::ok( $simpsons + $bouviers == $both, "op_union" );

  ::ok( $bouviers + $simpsons == $both, "op union with ops reversed" );

  ::ok( $simpsons + $simpsons == $simpsons, "union with self" );

  ::ok( $simpsons + $empty == $simpsons, "union with empty set" );
}