o Fix PureCondorcetVote to return all results, not just the winner
[rubyvote] / test / election_test.rb
1 #!/usr/bin/ruby -Ilib
2
3 require 'test/unit'
4 require 'rubyvote/election'
5
6 class TestElectionVote < Test::Unit::TestCase
7
8   def test_plurality
9     vote_array = "ABCABCABCCCBBAAABABABCCCCCCCCCCCCCA".split("")
10
11     assert_equal( "C", PluralityVote.new(vote_array).result.winners[0] )
12   end
13
14
15   def test_approval
16     vote_array = Array.new
17     10.times {vote_array << "AB".split("")}
18     10.times {vote_array << "CB".split("")}
19     11.times {vote_array << "AC".split("")}
20     5.times {vote_array << "A".split("")}
21
22     assert_equal( "A", ApprovalVote.new(vote_array).result.winners[0] )
23   end
24 end
25

Benjamin Mako Hill || Want to submit a patch?