]> projects.mako.cc - rubyvote/blobdiff - test/election_test.rb
Fixed positional test-case to test for correct winner, not most recent winner.
[rubyvote] / test / election_test.rb
index e8a9c452f1cb7c8f1f2993d66591e32f61692ab4..7675e58a01c8eb1fe4a254d57f6204062dc27619 100644 (file)
@@ -11,7 +11,16 @@ class TestElectionVote < Test::Unit::TestCase
     assert_equal( "C", PluralityVote.new(vote_array).result.winners[0] )
   end
 
+  def test_plurality_nonstring
+    vote_array = [1,2,3,1,1,1,2,3]
+    assert_equal( 1, PluralityVote.new(vote_array).result.winners[0] )
+  end
 
+  def test_invalid_voteobj
+    vote_array = [1,2,nil,1]
+    assert_raise(InvalidVoteError) { PluralityVote.new(vote_array).result.winners[0] }
+  end
+  
   def test_approval
     vote_array = Array.new
     10.times {vote_array << "AB".split("")}

Benjamin Mako Hill || Want to submit a patch?