Skip to content

Commit

Permalink
Addressed requested changes from review.
Browse files Browse the repository at this point in the history
  • Loading branch information
michelleblom committed Aug 2, 2024
1 parent aaf7e05 commit 54ea0aa
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import static au.org.democracydevelopers.corla.util.testUtils.log;
import static org.mockito.Mockito.when;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.Assert.assertEquals;

import au.org.democracydevelopers.corla.model.assertion.Assertion;
import au.org.democracydevelopers.corla.model.assertion.AssertionTests;
Expand Down Expand Up @@ -593,9 +593,9 @@ public void testComputeDiscrepancyCVR_A_ACVR_ABCD(RecordType auditedType){
}

/**
* Test that if we follow discrepancy computation with an invalid call to recordDiscrepancy().
* (Invalid in the sense that the provided discrepancy type is not the maximum across the
* audit's assertions for the given CVR).
* Test that if we follow discrepancy computation with an invalid call to recordDiscrepancy() then
* an IllegalArgumentException is thrown. (Invalid in the sense that the provided discrepancy type
* is not the maximum across the audit's assertions for the given CVR).
*/
@Test(expectedExceptions = IllegalArgumentException.class)
public void testRecordWrongDiscrepancy(){
Expand Down Expand Up @@ -714,7 +714,9 @@ public void testComputeDiscrepancyCVR_BACD_ACVR_ABCD(RecordType auditedType){
/**
* Discrepancy computation and recording for 'Mixed Contest' with CVR "B","A","C","D" and
* audited ballot "A","B","C","D". The maximum discrepancy is 1. Also checks risk measurement
* before and after the removal of the recorded discrepancies against the ballot/CVR pair.
* before and after the removal of the recorded discrepancies against the ballot/CVR pair. We
* use Equation 9 in Stark's Super Simple Simultaneous Comparison Single-Ballot Risk Limiting
* Audits to compute the expected risk values.
*/
@Test(dataProvider = "AuditedRecordTypes", dataProviderClass = AssertionTests.class)
public void testComputeRecordRemoveDiscrepancyCVR_BACD_ACVR_ABCD(RecordType auditedType){
Expand Down Expand Up @@ -750,7 +752,9 @@ public void testComputeRecordRemoveDiscrepancyCVR_BACD_ACVR_ABCD(RecordType audi
/**
* Discrepancy computation and recording for 'Mixed Contest 2' with CVR "B","A","C","D" and
* audited ballot "A","B","C","D". The maximum discrepancy is -1. Also checks risk measurement
* before and after the removal of the recorded discrepancies against the ballot/CVR pair.
* before and after the removal of the recorded discrepancies against the ballot/CVR pair. We
* use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot Risk Limiting Audits to compute the expected
* risk values.
*/
@Test(dataProvider = "AuditedRecordTypes", dataProviderClass = AssertionTests.class)
public void testComputeRecordRemoveDiscrepancyCVR_BACD_ACVR_ABCD_mixed2(RecordType auditedType){
Expand Down Expand Up @@ -786,7 +790,9 @@ public void testComputeRecordRemoveDiscrepancyCVR_BACD_ACVR_ABCD_mixed2(RecordTy
/**
* Discrepancy computation and recording for 'Simple Contest 3' with CVR "B","A","C","D" and
* audited ballot "A","B","C","D". The maximum discrepancy is -2. Also checks risk measurement
* before and after the removal of the recorded discrepancies against the ballot/CVR pair.
* before and after the removal of the recorded discrepancies against the ballot/CVR pair. We
* use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot Risk Limiting Audits to compute the expected
* risk values.
*/
@Test(dataProvider = "AuditedRecordTypes", dataProviderClass = AssertionTests.class)
public void testComputeRecordRemoveDiscrepancyCVR_BACD_ACVR_ABCD_simple3(RecordType auditedType){
Expand Down Expand Up @@ -879,7 +885,8 @@ public void testComputeDiscrepancyCVR_blank_ACVR_ABCD(RecordType auditedType){
/**
* Discrepancy computation and recording for 'Mixed Contest' with CVR blank and audited ballot
* "A","B","C","D". The maximum discrepancy is 0. Also checks risk measurement before and after
* the removal of the recorded discrepancies against the ballot/CVR pair.
* the removal of the recorded discrepancies against the ballot/CVR pair. We use Equation 9 in
* Stark's Super Simple Simultaneous Single-Ballot Risk Limiting Audits to compute the expected risk values.
*/
@Test(dataProvider = "AuditedRecordTypes", dataProviderClass = AssertionTests.class)
public void testComputeRecordRemoveDiscrepancyCVR_blank_ACVR_ABCD(RecordType auditedType){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ public static void checkCountsDiscrepancyMap(final Assertion a, int oneOver, int

/**
* Checks whether an assertion's riskMeasurement() method calculates the correct risks for
* varying sample numbers.
* varying sample numbers (note that discrepancies may be present and stored in the given
* Assertion).
* @param a Assertion whose riskMeasurement() method we are testing.
* @param risks Map of expected sample counts to risk values.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
* -- Scoring of NEB assertions.
* -- Computation of discrepancies for NEB assertions.
* -- The logic involved in the re-auditing of ballots.
* -- Risk measurement (we use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values).
* Refer to the Guide to RAIRE for details on how NEB assertions are scored, and how
* discrepancies are computed (Part 2, Appendix A).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
* -- Scoring of NEN assertions.
* -- Computation of discrepancies.
* -- The logic involved in the re-auditing of ballots.
* -- Risk measurement (we use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values).
* Refer to the Guide to RAIRE for details on how NEN assertions are scored, and how
* discrepancies are computed (Part 2, Appendix A.)
*/
Expand Down Expand Up @@ -195,6 +197,8 @@ public void testNENRecordNoMatch2(){

/**
* Test riskMeasurement() for an NEN assertion with no discrepancies.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRiskMeasurementNoDiscrepancies(){
Expand All @@ -213,6 +217,8 @@ public void testNENRiskMeasurementNoDiscrepancies(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a one vote overstatement, in the context
* where the assertion has no recorded discrepancies. Also check risk measurement given one
* 1 vote overstatement and varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordOneVoteOverstatement1(){
Expand All @@ -234,6 +240,8 @@ public void testNENRecordOneVoteOverstatement1(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a one vote understatement, in the context
* where the assertion has no recorded discrepancies. Also check risk measurement in the context
* where the assertion has one 1 vote understatement and varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordOneVoteUnderstatement1(){
Expand All @@ -255,6 +263,8 @@ public void testNENRecordOneVoteUnderstatement1(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a two vote overstatement, in the context
* where the assertion has no recorded discrepancies. Also check risk measurement in the context
* where the assertion has one 2 vote overstatement and varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordTwoVoteOverstatement1(){
Expand All @@ -276,6 +286,8 @@ public void testNENRecordTwoVoteOverstatement1(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a two vote understatement, in the context
* where the assertion has no recorded discrepancies. Also check risk measurement in the context
* where the assertion has one 2 vote understatement and varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordTwoVoteUnderstatement1(){
Expand All @@ -297,6 +309,8 @@ public void testNENRecordTwoVoteUnderstatement1(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a two vote understatement, in the context
* where the assertion has no recorded discrepancies. Also check risk measurement in the context
* where the assertion has one other discrepancies and varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordOther1(){
Expand All @@ -318,6 +332,8 @@ public void testNENRecordOther1(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a one vote overstatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordOneVoteOverstatement2(){
Expand All @@ -340,6 +356,8 @@ public void testNENRecordOneVoteOverstatement2(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a one vote understatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordOneVoteUnderstatement2(){
Expand All @@ -362,6 +380,8 @@ public void testNENRecordOneVoteUnderstatement2(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a two vote overstatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordTwoVoteOverstatement2(){
Expand All @@ -384,6 +404,8 @@ public void testNENRecordTwoVoteOverstatement2(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for a two vote understatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordTwoVoteUnderstatement2(){
Expand All @@ -406,6 +428,8 @@ public void testNENRecordTwoVoteUnderstatement2(){
* Test Assertion::recordDiscrepancy(CVRAuditInfo) for an "other" discrepancy, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRecordOther2(){
Expand All @@ -432,6 +456,8 @@ public void testNENRecordOther2(){
* there, the value matching the ID key is retrieved, the associated discrepancy type
* decremented, and the ID removed from the map. If it is not there, then the discrepancy counts
* and the map are not changed. Also test risk measurement in this context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveNoMatch1(){
Expand All @@ -454,6 +480,8 @@ public void testNENRemoveNoMatch1(){
* been computed for the given CVR-ACVR pair, and the assertion has some discrepancies recorded
* already. It should not change the assertion's discrepancy counts. Also test risk measurement in
* this context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveNoMatch2(){
Expand All @@ -475,6 +503,8 @@ public void testNENRemoveNoMatch2(){
/**
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a one vote overstatement. Also test risk
* measurement in this context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveOneVoteOverstatement1(){
Expand All @@ -495,6 +525,8 @@ public void testNENRemoveOneVoteOverstatement1(){
/**
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a one vote understatement. Also test risk
* measurement in this context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveOneVoteUnderstatement1(){
Expand All @@ -515,6 +547,8 @@ public void testNENRemoveOneVoteUnderstatement1(){
/**
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a two vote overstatement. Also test risk
* measurement in this context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveTwoVoteOverstatement1(){
Expand All @@ -535,6 +569,8 @@ public void testNENRemoveTwoVoteOverstatement1(){
/**
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a two vote understatement. Also test risk
* measurement in this context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveTwoVoteUnderstatement1(){
Expand All @@ -555,6 +591,8 @@ public void testNENRemoveTwoVoteUnderstatement1(){
/**
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for an "other" discrepancy. Also test risk
* measurement in this context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveOther1(){
Expand All @@ -576,6 +614,8 @@ public void testNENRemoveOther1(){
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a one vote overstatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveOneVoteOverstatement2(){
Expand All @@ -598,6 +638,8 @@ public void testNENRemoveOneVoteOverstatement2(){
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a one vote understatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveOneVoteUnderstatement2(){
Expand All @@ -620,6 +662,8 @@ public void testNENRemoveOneVoteUnderstatement2(){
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a two vote overstatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveTwoVoteOverstatement2(){
Expand All @@ -642,6 +686,8 @@ public void testNENRemoveTwoVoteOverstatement2(){
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for a two vote understatement, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveTwoVoteUnderstatement2(){
Expand All @@ -664,6 +710,8 @@ public void testNENRemoveTwoVoteUnderstatement2(){
* Test Assertion::removeDiscrepancy(CVRAuditInfo) for an "other" discrepancy, in the context
* where the assertion has already recorded discrepancies. Also test risk measurement in this
* context with varying sample counts.
* We use Equation 9 in Stark's Super Simple Simultaneous Single-Ballot
* Risk Limiting Audits to compute the expected risk values.
*/
@Test
public void testNENRemoveOther2(){
Expand Down

0 comments on commit 54ea0aa

Please sign in to comment.