]> projects.mako.cc - rubyvote/blobdiff - test/positional_test.rb
Created victories_and_ties method for table use.
[rubyvote] / test / positional_test.rb
index a43709d60c298103847f48403e9b5794f8510d20..bb81c7ec7109729c9652266aa3ed65bc67a0dba3 100644 (file)
@@ -5,14 +5,21 @@ require 'rubyvote/election'
 require 'rubyvote/positional'
 
 class TestPositionalVote < Test::Unit::TestCase
 require 'rubyvote/positional'
 
 class TestPositionalVote < Test::Unit::TestCase
-
+  
+  def test_borda_empty
+    vote_array = Array.new
+    assert_nil BordaVote.new(vote_array).result.winners[0]
+    assert_equal(false, BordaVote.new(vote_array).result.winner?)
+  end
+  
   def test_borda
     vote_array = Array.new
   def test_borda
     vote_array = Array.new
+    2.times {vote_array << "BAC".split("")}
     3.times {vote_array << "ABC".split("")}
     3.times {vote_array << "CBA".split("")}
     3.times {vote_array << "ABC".split("")}
     3.times {vote_array << "CBA".split("")}
-    2.times {vote_array << "BAC".split("")}
-
+    
     assert_equal( "B", BordaVote.new(vote_array).result.winners[0] )
   end
     assert_equal( "B", BordaVote.new(vote_array).result.winners[0] )
   end
+  
 end
 
 end
 

Benjamin Mako Hill || Want to submit a patch?