diff --git a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/IRVComparisonAuditTests.java b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/IRVComparisonAuditTests.java index e5626ca8..e49e950c 100644 --- a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/IRVComparisonAuditTests.java +++ b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/IRVComparisonAuditTests.java @@ -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; @@ -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(){ @@ -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){ @@ -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){ @@ -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){ @@ -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){ diff --git a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/AssertionTests.java b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/AssertionTests.java index 3b5cfdca..cd965f24 100644 --- a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/AssertionTests.java +++ b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/AssertionTests.java @@ -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. */ diff --git a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NEBAssertionTests.java b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NEBAssertionTests.java index be36f501..724a340f 100644 --- a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NEBAssertionTests.java +++ b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NEBAssertionTests.java @@ -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). */ diff --git a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NENAssertionTests.java b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NENAssertionTests.java index 647be1ea..d31d066b 100644 --- a/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NENAssertionTests.java +++ b/server/eclipse-project/src/test/java/au/org/democracydevelopers/corla/model/assertion/NENAssertionTests.java @@ -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.) */ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){