Browse Source

test: test numeric score

master
Dominique Merle 1 year ago
parent
commit
85e0c3e419
  1. 20
      src/test/java/fr/mieuxvoter/mj/MajorityJudgmentDeliberatorTest.java

20
src/test/java/fr/mieuxvoter/mj/MajorityJudgmentDeliberatorTest.java

@ -367,6 +367,26 @@ class MajorityJudgmentDeliberatorTest {
assertEquals(1, result.getProposalResults()[2].getAnalysis().getMedianGrade());
}
@Test
@DisplayName("Test numeric score")
public void testNumericScore() throws Exception {
boolean favorContestation = true;
boolean numerizeScore = true;
Integer amountOfJudges = 3;
DeliberatorInterface mj = new MajorityJudgmentDeliberator(favorContestation, numerizeScore);
TallyInterface tally = new Tally(new ProposalTallyInterface[] {
new ProposalTally(new Integer[]{ 1, 0, 2 }),
new ProposalTally(new Integer[]{ 0, 2, 1 }),
}, amountOfJudges);
ResultInterface result = mj.deliberate(tally);
assertNotNull(result);
assertEquals("202003003", result.getProposalResults()[0].getScore());
assertEquals("104203003", result.getProposalResults()[1].getScore());
}
@Test
@DisplayName("Fail on unbalanced tallies")
public void testFailureOnUnbalancedTallies() {

Loading…
Cancel
Save