- Timestamp:
- 04/17/09 15:32:47 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/t/10Vote_DB.t
r213 r214 60 60 a => { sbal => [ 'ch1' ] }, 61 61 b => { sbal => [ 'ch1', 'ch10' ] }, 62 d => { sbal => [ 'ch1', 'ch2' ] },62 d => { sbal => [ 'ch1', 'ch2', 'ch4' ] }, 63 63 f => {}, 64 64 }, 65 test_count => 9,65 test_count => 10, 66 66 tests => sub { 67 67 my ($r) = @_; … … 69 69 is($r->absolute_majority, 2, "Can get absolute_majority"); 70 70 is($r->ballot_count, 4, "can get ballot count"); 71 is($r->ballot_count_nonull, 3, "can get ballot count"); 71 is($r->not_empty_ballot_count, 3, "can get ballot count"); 72 is($r->empty_ballot_count, 1, "can get empty ballot count"); 72 73 is($r->voting_count, 6, "can get voting count"); 73 74 is($r->signing_count, 4, "can get signing count"); 74 my $res = $r->results _nonull;75 my $res = $r->results; 75 76 is($res->[0]->{value}, 'ch1', "winner is ch1"); 76 77 is($res->[0]->{count}, 3, "winner has 3 voices"); 77 is(@$res, 3, "count of winners"); 78 is($res->[2]->{count}, 0, "last has 0 voices"); 78 is(@$res, 4, "count of winners"); 79 is($res->[3]->{count}, 0, "last has 0 voices"); 80 } 81 }, 82 { 83 poll => { 84 label => 'empty ballot count', 85 empty_ballot_has_voice => 1, 86 }, 87 choices => [ qw(ch1 ch2 ch3) ], 88 voting => [ qw(a b c d e f) ], 89 ballot => { 90 a => { sbal => [ 'ch1' ] }, 91 b => { sbal => [ 'ch1', 'ch2' ] }, 92 d => { sbal => [ 'ch1', 'ch2' ] }, 93 e => {}, 94 f => {}, 95 }, 96 test_count => 10, 97 tests => sub { 98 my ($r) = @_; 99 is($r->absolute_majority, 3, "Can get absolute_majority"); 100 is($r->ballot_count, 5, "can get ballot count"); 101 is($r->not_empty_ballot_count, 3, "can get ballot count"); 102 is($r->empty_ballot_count, 2, "can get empty ballot count"); 103 is($r->voting_count, 6, "can get voting count"); 104 is($r->signing_count, 5, "can get signing count"); 105 my $res = $r->results; 106 is($res->[0]->{value}, 'ch1', "winner is ch1"); 107 is($res->[0]->{count}, 3, "winner has 3 voices"); 108 is(@$res, 4, "count of winners"); 109 is($res->[3]->{count}, 0, "last has 0 voices"); 79 110 } 80 111 },
Note: See TracChangeset
for help on using the changeset viewer.