X-Git-Url: https://projects.mako.cc/source/rubyvote/blobdiff_plain/74e5c5f3c50a36d8d8589c243395b9158977f4db..0ef8f53fb812bcc40337a92f9c4d11ab193f73a9:/test/election_test.rb diff --git a/test/election_test.rb b/test/election_test.rb new file mode 100644 index 0000000..b182e2d --- /dev/null +++ b/test/election_test.rb @@ -0,0 +1,26 @@ +#!/usr/bin/ruby + +require 'test/unit' +require 'election_test_helper' + +class TestElectionVote < Test::Unit::TestCase + include ElectionTestHelper + + def test_plurality + vote_array = "ABCABCABCCCBBAAABABABCCCCCCCCCCCCCA".split("") + + test_winner( "C", PluralityVote.new(vote_array).result ) + end + + + def test_approval + vote_array = Array.new + 10.times {vote_array << "AB".split("")} + 10.times {vote_array << "CB".split("")} + 11.times {vote_array << "AC".split("")} + 5.times {vote_array << "A".split("")} + + test_winner( "A", ApprovalVote.new(vote_array).result ) + end +end +