test: with thousands of proposals

pull/9/head
Dominique Merle 3 years ago
parent 3a89019787
commit 370bb27d7f

@ -5,7 +5,7 @@
[![Release](https://img.shields.io/github/v/release/MieuxVoter/majority-judgment-library-java?sort=semver)](https://github.com/MieuxVoter/majority-judgment-library-java/releases)
[![Join the Discord chat at https://discord.gg/rAAQG9S](https://img.shields.io/discord/705322981102190593.svg)](https://discord.gg/rAAQG9S)
Test-driven java library to help deliberate using Majority Judgment.
Test-driven java library to help deliberate using [Majority Judgment](https://mieuxvoter.fr/index.php/decouvrir/?lang=en).
The goal is to be **scalable**, **reliable**, fast and extensible.
We therefore use a _score-based algorithm_ and _no floating-point arithmetic_ whatsoever.

@ -110,6 +110,25 @@ class MajorityJudgmentDeliberatorTest {
assertEquals(1, result.getProposalResults()[1].getRank());
}
@Test
public void testWithThousandsOfProposals() {
int amountOfProposals = 1337;
DeliberatorInterface mj = new MajorityJudgmentDeliberator();
ProposalTallyInterface[] tallies = new ProposalTallyInterface[amountOfProposals];
for (int i = 0 ; i < amountOfProposals ; i++) {
tallies[i] = new ProposalTally(new Integer[]{ 0, 2, 1 });
}
TallyInterface tally = new TallyWithDefaultGrade(tallies, 3, 0);
ResultInterface result = mj.deliberate(tally);
assertNotNull(result);
assertEquals(amountOfProposals, result.getProposalResults().length);
for (int i = 0 ; i < amountOfProposals ; i++) {
assertEquals(1, result.getProposalResults()[i].getRank());
}
}
// @Test
// public void runBenchmarks() throws Exception {
// Options options = new OptionsBuilder()

Loading…
Cancel
Save