File: remove.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 (31 lines) | stat: -rw-r--r-- 871 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
use Set::Object;

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

populate();

$patty = $patty;
$selma = $selma;
$burns = $burns;

Set::Object->new->remove($patty);

$simpsons = Set::Object->new($homer, $marge, $bart, $lisa, $maggie);

use Test::More tests => 7;

$removed = $simpsons->remove($homer);

is($simpsons->size(), 4, "new size correct after remove");
is($removed, 1, "remove returned number of elements removed");
is($simpsons, Set::Object->new($marge, $bart, $lisa, $maggie),
   "set contents correct");

$removed = $simpsons->remove($burns);
is($simpsons->size(), 4, "remove of non-member didn't reduce size");
is($removed, 0, "remove returned no elements removed");

$removed = $simpsons->remove($patty, $marge, $selma);
is($simpsons->size(), 3, "remove of mixed members & non-members");
is($removed, 1, "remove returned correct num of elements removed");