Skip to content

Commit

Permalink
Added spreadsheet test scenario 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlschroedl committed Jul 11, 2018
1 parent eb69d61 commit 9be1576
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/RankedPairsCalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,21 @@ public function testScenario2()
$this->assertEquals($expectedRanking, $actualRanking);
}

/**
* Scenario 3 from the test spreadsheet
* https://docs.google.com/spreadsheets/d/1634wP6-N8GG2Fig-yjIOk7vPBn4AijXOrjq6Z2T1K8M/edit?usp=sharing
*/
public function testScenario3()
{
$expectedRanking = (new CandidateRankingParser())->parse("MN>MC>BT>FE=CS>RR");

$ballots = (new TestScenario3())->getBallots();
$tieBreakingBallot = $ballots[0];

$instance = new RankedPairsCalculator($tieBreakingBallot);
$results = $instance->calculate(sizeof($ballots), ...$ballots);
$actualRanking = $results->getRanking();

$this->assertEquals($expectedRanking, $actualRanking);
}
}

0 comments on commit 9be1576

Please sign in to comment.