Add testcases for calling results to empty votes.
[rubyvote] / test / positional_test.rb
1 #!/usr/bin/ruby -Ilib
2
3 require 'test/unit'
4 require 'rubyvote/election'
5 require 'rubyvote/positional'
6
7 class TestPositionalVote < Test::Unit::TestCase
8   
9   def test_borda_empty
10     vote_array = Array.new
11     assert_nil BordaVote.new(vote_array).result.winners[0]
12   end
13   
14   def test_borda
15     vote_array = Array.new
16     2.times {vote_array << "BAC".split("")}
17     3.times {vote_array << "ABC".split("")}
18     3.times {vote_array << "CBA".split("")}
19     
20     assert_equal( "B", BordaVote.new(vote_array).result.winners[0] )
21   end
22   
23 end
24

Benjamin Mako Hill || Want to submit a patch?