Algorithm-Pair-Swiss
view release on metacpan or search on metacpan
#!/usr/bin/perl -w
use Test::More tests => 4;
use Algorithm::Pair::Swiss;
my $pairer = Algorithm::Pair::Swiss->new;
$pairer->parties(1,2,3);
my @pairs = $pairer->pairs;
ok( @pairs == 2, 'two pairs for three parties');
$pairer->exclude(@pairs);
@pairs = $pairer->pairs;
ok( @pairs == 2, 'still two pairs after first exclusion');
$pairer->exclude(@pairs);
@pairs = $pairer->pairs;
ok( @pairs == 2, 'still two pairs after second exclusion');
$pairer->exclude(@pairs);
@pairs = $pairer->pairs;
ok( @pairs == 0, 'no more pairs after third exclusion');
( run in 0.683 second using v1.01-cache-2.11-cpan-39bf76dae61 )