Skip to content

Commit

Permalink
Added spreadsheet test scenario 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlschroedl committed Jul 11, 2018
1 parent 9be1576 commit a1c63ee
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/RankedPairsCalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,22 @@ public function testScenario3()

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

/**
* Scenario 4 from the test spreadsheet
* https://docs.google.com/spreadsheets/d/1634wP6-N8GG2Fig-yjIOk7vPBn4AijXOrjq6Z2T1K8M/edit?usp=sharing
*/
public function testScenario4()
{
$expectedRanking = (new CandidateRankingParser())->parse("CW>BB>CS>BT=SY");

$ballots = (new TestScenario4())->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 a1c63ee

Please sign in to comment.