]> projects.mako.cc - rubyvote/blobdiff - test/irv_test.rb
Fix problem with a [nil] result being taken as having a winner; add testcases
[rubyvote] / test / irv_test.rb
index fa05dc99bd62ebef470826eec4bad690a1b6d94b..d3a57a7c7d8cec68e31a4c85cf0ba89c675cea2b 100644 (file)
@@ -9,6 +9,7 @@ class TestRunoffVote < Test::Unit::TestCase
   def test_irv_empty
     vote_array = Array.new
     assert_nil InstantRunoffVote.new(vote_array).result.winners[0]
+    assert_equal(false, InstantRunoffVote.new(vote_array).result.winner?)
   end
   
   def test_irv
@@ -59,6 +60,7 @@ class TestRunoffVote < Test::Unit::TestCase
   def test_irv_logic_empty
     vote_array = Array.new
     assert_nil InstantRunoffLogicVote.new(vote_array).result.winners[0]
+    assert_equal(false, InstantRunoffLogicVote.new(vote_array).result.winner?)
   end
   
   def test_irv_logic1

Benjamin Mako Hill || Want to submit a patch?