projects
/
rubyvote
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Work around CloneProofSSD returning [nil] rather than [] for empty vote
[rubyvote]
/
test
/
irv_test.rb
diff --git
a/test/irv_test.rb
b/test/irv_test.rb
index 49aa540e02a958bb1220ef22f47987e7d227b64d..d3a57a7c7d8cec68e31a4c85cf0ba89c675cea2b 100644
(file)
--- a/
test/irv_test.rb
+++ b/
test/irv_test.rb
@@
-6,6
+6,12
@@
require 'rubyvote/irv'
class TestRunoffVote < Test::Unit::TestCase
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
vote_array = Array.new
142.times {vote_array << "ABCD".split("")}
def test_irv
vote_array = Array.new
142.times {vote_array << "ABCD".split("")}
@@
-50,7
+56,13
@@
class TestRunoffVote < Test::Unit::TestCase
assert_equal( "C", InstantRunoffVote.new(vote_array).result.winners[0] )
end
assert_equal( "C", InstantRunoffVote.new(vote_array).result.winners[0] )
end
-
+
+ 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
vote_array = Array.new
42.times {vote_array << "ABCD".split("")}
def test_irv_logic1
vote_array = Array.new
42.times {vote_array << "ABCD".split("")}
Benjamin Mako Hill
||
Want to submit a patch?