Algorithm-Voting

 view release on metacpan or  search on metacpan

lib/Algorithm/Voting/Plurality.pm  view on Meta::CPAN

of the vote."

=back

=head1 METHODS

=head2 Algorithm::Voting::Plurality->new(%args)

Constructs a "ballot box" object that will use the Plurality criterion to
decide the winner.  Optionally, specify a list of candidates; any ballot added
to the box that does not indicate one of the listed candidates throws an
exception.

Example:

    # construct a ballot box that accepts only three candidates
    my @c = qw( John Barack Ralph );
    my $box = Algorithm::Voting::Plurality->new(candidates => \@c);

=cut

t/sortition/04-seq.t  view on Meta::CPAN

    is_deeply( [ $s->seq ], [ (0xffff) x 5 ] );
}

# verify that non-hex digests raise an exception
{
    no warnings qw/ once redefine /;
    local *Algorithm::Voting::Sortition::digest = sub { return "zzzz"; };
    local *Algorithm::Voting::Sortition::n      = sub { return 5 };
    my $s = $avs->new(candidates => ['a'..'e']);
    my @seq;
    throws_ok { @seq = $s->seq } qr/invalid hex/, "invalid hex raises exception";
    warn "@seq";
}



( run in 0.447 second using v1.01-cache-2.11-cpan-496ff517765 )