Add testcases for calling results to empty votes.
[rubyvote] / test / positional_test.rb
index 3f1fcfb147c7be50136dc4e34aace90883286d6d..76be74d7c55e2b88c32b6874e888e3d46a00e495 100644 (file)
@@ -1,18 +1,24 @@
-#!/usr/bin/ruby
+#!/usr/bin/ruby -Ilib
 
 require 'test/unit'
-require 'election_test_helper'
+require 'rubyvote/election'
+require 'rubyvote/positional'
 
 class TestPositionalVote < Test::Unit::TestCase
-  include ElectionTestHelper
-
+  
+  def test_borda_empty
+    vote_array = Array.new
+    assert_nil BordaVote.new(vote_array).result.winners[0]
+  end
+  
   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("")}
-    2.times {vote_array << "BAC".split("")}
-
-    test_winner( "B", BordaVote.new(vote_array).result )
+    
+    assert_equal( "B", BordaVote.new(vote_array).result.winners[0] )
   end
+  
 end
 

Benjamin Mako Hill || Want to submit a patch?