o Test that elections with a single vote return the expected result.
[rubyvote] / lib / rubyvote / condorcet.rb
index 96a103bd479c5bcf3e7d575cacd5d71f4afe8f78..340be9273f05fe7915a74902b4c049f8985834c8 100644 (file)
@@ -133,6 +133,7 @@ class CondorcetResult < ElectionResult
     votes = @election.votes unless votes
 
     defeats = Array.new
+    candidates = [candidates] unless candidates.class == Array
     candidates.each do |candidate|
       candidates.each do |challenger|
         next if candidate == challenger
@@ -204,6 +205,7 @@ class CloneproofSSDResult < CondorcetResult
       # see the array with the standard defeats
       transitive_defeats = self.defeats(candidates, votes)
 
+      candidates = [candidates] unless candidates.class == Array
       candidates.each do |cand1|
         candidates.each do |cand2|
           candidates.each do |cand3|

Benjamin Mako Hill || Want to submit a patch?