X-Git-Url: https://projects.mako.cc/source/rubyvote/blobdiff_plain/d28df2a4166aa83fd9a0eb1f5a0599b8fc1c9798..HEAD:/test/election_test.rb diff --git a/test/election_test.rb b/test/election_test.rb index 7675e58..26d8b91 100644 --- a/test/election_test.rb +++ b/test/election_test.rb @@ -5,6 +5,12 @@ require 'rubyvote/election' class TestElectionVote < Test::Unit::TestCase + def test_plurality_empty + vote_array = [] + assert_nil PluralityVote.new(vote_array).result.winners[0] + assert_equal(false, PluralityVote.new(vote_array).result.winner?) + end + def test_plurality vote_array = "ABCABCABCCCBBAAABABABCCCCCCCCCCCCCA".split("") @@ -21,6 +27,12 @@ class TestElectionVote < Test::Unit::TestCase assert_raise(InvalidVoteError) { PluralityVote.new(vote_array).result.winners[0] } end + def test_approval_empty + vote_array = [] + assert_nil ApprovalVote.new(vote_array).result.winners[0] + assert_equal(false, ApprovalVote.new(vote_array).result.winner?) + end + def test_approval vote_array = Array.new 10.times {vote_array << "AB".split("")}