diff --git a/src/test/java/network/brightspots/rcv/TabulatorTests.java b/src/test/java/network/brightspots/rcv/TabulatorTests.java index 83ceb2067..ad4a8ab2f 100644 --- a/src/test/java/network/brightspots/rcv/TabulatorTests.java +++ b/src/test/java/network/brightspots/rcv/TabulatorTests.java @@ -451,4 +451,16 @@ void tiebreakPreviousRoundCountsThenRandomTest() { void treatBlankAsUndeclaredWriteInTest() { runTabulationTest("test_set_treat_blank_as_undeclared_write_in"); } + + @Test + @DisplayName("undeclared write-in (UWI) cannot win test") + void uwiCannotWinTest() { + runTabulationTest("uwi_cannot_win_test"); + } + + @Test + @DisplayName("multi-seat UWI test") + void multiSeatUwiTest() { + runTabulationTest("multi_seat_uwi_test"); + } } diff --git a/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_config.json b/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_config.json new file mode 100644 index 000000000..54292b08f --- /dev/null +++ b/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_config.json @@ -0,0 +1,54 @@ +{ + "tabulatorVersion" : "TEST", + "outputSettings" : { + "contestName" : "Multi-Seat UWI Test", + "outputDirectory" : "output", + "contestDate" : "", + "contestJurisdiction" : "", + "contestOffice" : "", + "tabulateByPrecinct" : false, + "generateCdfJson" : false + }, + "cvrFileSources" : [ { + "filePath" : "multi_seat_uwi_test_cvr.xlsx", + "firstVoteColumnIndex" : "2", + "firstVoteRowIndex" : "2", + "idColumnIndex" : "", + "precinctColumnIndex" : "", + "provider" : "" + } ], + "candidates" : [ { + "name" : "A", + "code" : "", + "excluded" : false + }, { + "name" : "B", + "code" : "", + "excluded" : false + }, { + "name" : "C", + "code" : "", + "excluded" : false + } ], + "rules" : { + "tiebreakMode" : "usePermutationInConfig", + "overvoteRule" : "exhaustImmediately", + "winnerElectionMode" : "standard", + "randomSeed" : "", + "numberOfWinners" : "2", + "multiSeatBottomsUpPercentageThreshold" : "", + "decimalPlacesForVoteArithmetic" : "4", + "minimumVoteThreshold" : "0", + "maxSkippedRanksAllowed" : "1", + "maxRankingsAllowed" : "max", + "nonIntegerWinningThreshold" : false, + "hareQuota" : false, + "batchElimination" : false, + "exhaustOnDuplicateCandidate" : false, + "treatBlankAsUndeclaredWriteIn" : false, + "overvoteLabel" : "", + "undervoteLabel" : "", + "undeclaredWriteInLabel" : "UWI", + "rulesDescription" : "" + } +} diff --git a/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_cvr.xlsx b/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_cvr.xlsx new file mode 100644 index 000000000..1e1f73a4c Binary files /dev/null and b/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_cvr.xlsx differ diff --git a/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_expected_summary.json b/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_expected_summary.json new file mode 100644 index 000000000..593c50d73 --- /dev/null +++ b/src/test/resources/network/brightspots/rcv/test_data/multi_seat_uwi_test/multi_seat_uwi_test_expected_summary.json @@ -0,0 +1,66 @@ +{ + "config" : { + "contest" : "Multi-Seat UWI Test", + "date" : "", + "jurisdiction" : "", + "office" : "", + "threshold" : "6" + }, + "results" : [ { + "round" : 1, + "tally" : { + "A" : "6", + "B" : "3", + "C" : "2", + "UWI" : "4" + }, + "tallyResults" : [ { + "elected" : "A", + "transfers" : { } + } ] + }, { + "round" : 2, + "tally" : { + "A" : "6.0000", + "B" : "3", + "C" : "2", + "UWI" : "4" + }, + "tallyResults" : [ { + "eliminated" : "UWI", + "transfers" : { + "exhausted" : "4" + } + } ] + }, { + "round" : 3, + "tally" : { + "A" : "6.0000", + "B" : "3", + "C" : "2" + }, + "tallyResults" : [ { + "eliminated" : "C", + "transfers" : { + "exhausted" : "2" + } + } ] + }, { + "round" : 4, + "tally" : { + "A" : "6.0000", + "B" : "3" + }, + "tallyResults" : [ { + "elected" : "B", + "transfers" : { } + } ] + }, { + "round" : 5, + "tally" : { + "A" : "6.0000", + "B" : "3.0000" + }, + "tallyResults" : [ ] + } ] +} \ No newline at end of file diff --git a/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_config.json b/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_config.json new file mode 100644 index 000000000..f664a4630 --- /dev/null +++ b/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_config.json @@ -0,0 +1,50 @@ +{ + "tabulatorVersion" : "TEST", + "outputSettings" : { + "contestName" : "UWI Test", + "outputDirectory" : "output", + "contestDate" : "", + "contestJurisdiction" : "", + "contestOffice" : "", + "tabulateByPrecinct" : false, + "generateCdfJson" : false + }, + "cvrFileSources" : [ { + "filePath" : "uwi_cannot_win_test_cvr.xlsx", + "firstVoteColumnIndex" : "2", + "firstVoteRowIndex" : "2", + "idColumnIndex" : "", + "precinctColumnIndex" : "", + "provider" : "" + } ], + "candidates" : [ { + "name" : "A", + "code" : "", + "excluded" : false + }, { + "name" : "B", + "code" : "", + "excluded" : false + } ], + "rules" : { + "tiebreakMode" : "usePermutationInConfig", + "overvoteRule" : "exhaustImmediately", + "winnerElectionMode" : "standard", + "randomSeed" : "", + "numberOfWinners" : "1", + "multiSeatBottomsUpPercentageThreshold" : "", + "decimalPlacesForVoteArithmetic" : "4", + "minimumVoteThreshold" : "0", + "maxSkippedRanksAllowed" : "1", + "maxRankingsAllowed" : "max", + "nonIntegerWinningThreshold" : false, + "hareQuota" : false, + "batchElimination" : false, + "exhaustOnDuplicateCandidate" : false, + "treatBlankAsUndeclaredWriteIn" : false, + "overvoteLabel" : "", + "undervoteLabel" : "", + "undeclaredWriteInLabel" : "UWI", + "rulesDescription" : "" + } +} diff --git a/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_cvr.xlsx b/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_cvr.xlsx new file mode 100644 index 000000000..e3f4609a5 Binary files /dev/null and b/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_cvr.xlsx differ diff --git a/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_expected_summary.json b/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_expected_summary.json new file mode 100644 index 000000000..fddaf3c45 --- /dev/null +++ b/src/test/resources/network/brightspots/rcv/test_data/uwi_cannot_win_test/uwi_cannot_win_test_expected_summary.json @@ -0,0 +1,33 @@ +{ + "config" : { + "contest" : "UWI Test", + "date" : "", + "jurisdiction" : "", + "office" : "", + "threshold" : "3" + }, + "results" : [ { + "round" : 1, + "tally" : { + "A" : "3", + "B" : "1", + "UWI" : "5" + }, + "tallyResults" : [ { + "eliminated" : "UWI", + "transfers" : { + "exhausted" : "5" + } + } ] + }, { + "round" : 2, + "tally" : { + "A" : "3", + "B" : "1" + }, + "tallyResults" : [ { + "elected" : "A", + "transfers" : { } + } ] + } ] +} \ No newline at end of file