Added tie-breaking rules and multicandidate elimination of weak candidates
[rubyvote] / test.rb
diff --git a/test.rb b/test.rb
index e8c03a1..6b0b5c1 100755 (executable)
--- a/test.rb
+++ b/test.rb
@@ -126,8 +126,8 @@ def approval_test1
   print_winner( ApprovalVote.new(vote_array).result )
 end
 
-def runoff_test1
-  puts "USING RUNOFF..."
+def irv_test1
+  puts "USING IRV..."
   puts "The winner shold be: A"
 
   vote_array = Array.new
@@ -139,8 +139,8 @@ def runoff_test1
   print_winner( InstantRunoffVote.new(vote_array).result )
 end
 
-def runoff_test2
-  puts "USING RUNOFF..."
+def irv_test2
+  puts "USING IRV..."
   puts "The winner shold be: D"
 
   vote_array = Array.new
@@ -152,8 +152,8 @@ def runoff_test2
   print_winner( InstantRunoffVote.new(vote_array).result )
 end
 
-def runoff_test3
-  puts "USING RUNOFF..."
+def irv_test3
+  puts "USING IRV..."
   puts "The winner shold be: C"
 
   vote_array = Array.new
@@ -180,6 +180,19 @@ def runoff_test3
   print_winner( InstantRunoffVote.new(vote_array).result )
 end
 
+def irvlogic_test1
+  puts "USING IRV LOGIC..."
+  puts "The winner shold be: B"
+
+  vote_array = Array.new
+  42.times {vote_array << "ABCD".split("")}
+  26.times {vote_array << "BCDA".split("")}
+  15.times {vote_array << "CDBA".split("")}
+  15.times {vote_array << "DCBA".split("")}
+
+  print_winner( InstantRunoffLogicVote.new(vote_array).result )
+end
+
 def range_test1
   puts "USING RANGE..."
   puts "The winner shold be: B"
@@ -200,7 +213,8 @@ ssd_test3()
 borda_test1()
 plurality_test1()
 approval_test1()
-runoff_test1()
-runoff_test2()
-runoff_test3()
+irv_test1()
+irv_test2()
+irv_test3()
+irvlogic_test1()
 range_test1()

Benjamin Mako Hill || Want to submit a patch?