diff --git a/docs/validation.md b/docs/validation.md index 5414526..94e1baf 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -5,9 +5,9 @@ STV-counting software is frequently validated empirically by comparing the resul | Method | Election | Comparator | Included test case | |-|-|-|-| | Scottish STV | [2007 Glasgow council Linn ward election](https://web.archive.org/web/20121004213938/http://www.glasgow.gov.uk/en/YourCouncil/Elections_Voting/Election_Results/ElectionScotland2007/LGWardResults.htm?ward=1&wardname=1%20-%20Linn) | eSTV 2.0.16 (official) | ✓ | -| OpenTally Meek | [Ballot papers derived from the ERS97 model election](https://yingtongli.me/blog/2021/01/04/ers97.html) | [Algorithm 123](https://www.dia.govt.nz/diawebsite.NSF/Files/meekm/%24file/meekm.pdf) | ✓ | -| Meek STV (2006) | Ballot papers derived from the ERS97 model election | [OpenSTV 1.7](https://github.com/Conservatory/openstv) | ✓ | -| Meek STV (New Zealand) | Ballot papers derived from the ERS97 model election | OpenSTV 1.7, [Hill's nzmeek 6.7.7](https://yingtongli.me/blog/2021/07/08/nzmeek.html) | ✓ | +| OpenTally Meek | [Reverse engineered ballot papers for the ERS97 model election](https://yingtongli.me/blog/2021/01/04/ers97.html) | [Algorithm 123](https://www.dia.govt.nz/diawebsite.NSF/Files/meekm/%24file/meekm.pdf) | ✓ | +| Meek STV (2006) | Reverse engineered ballot papers for the ERS97 model election | [OpenSTV 1.7](https://github.com/Conservatory/openstv) | ✓ | +| Meek STV (New Zealand) | Reverse engineered ballot papers for the ERS97 model election | OpenSTV 1.7, [Hill's nzmeek 6.7.7](https://yingtongli.me/blog/2021/07/08/nzmeek.html) | ✓ | | Australian Senate STV | [2019 Tasmanian Senate election](https://results.aec.gov.au/24310/Website/SenateDownloadsMenu-24310-Csv.htm) | EasyCount (official) | ✓ | | Australian Senate STV | [2019 NSW Senate election](https://results.aec.gov.au/24310/Website/SenateDownloadsMenu-24310-Csv.htm) | EasyCount (official) | | | Australian Capital Territory STV | [2020 Kurrajong Legislative Assembly election](https://www.elections.act.gov.au/elections_and_voting/2020_legislative_assembly_election/ballot-paper-preference-data-2020-election) | [eVACS 2020](https://www.elections.act.gov.au/elections_and_voting/electronic_voting_and_counting) (official) | ✓ | @@ -16,7 +16,8 @@ STV-counting software is frequently validated empirically by comparing the resul | Cambridge STV | [2003 Cambridge City Council election](https://web.archive.org/web/20070204083508/http://stv.sourceforge.net/) | OpenSTV 1.7, [ChoicePlus Pro 2.1](https://www.votingsolutions.com/cpdetail.htm) (official) | ✓ | | Wright STV | [EVE Online CSM 15 election](https://www.eveonline.com/news/view/meet-the-new-council) | [ccp-wright-stv](https://github.com/ccpgames/ccp-wright-stv) (official) | ✓ | | PRSA 1977 | [*Proportional Representation Manual*](https://www.prsa.org.au/publicat.htm#p2) [example 1](https://www.prsa.org.au/utopiatc.pdf) | [Model result](https://www.prsa.org.au/example1.pdf) (official) | ✓ | -| ERS97 | Ballot papers derived from the ERS97 model election | [Model result](https://www.electoral-reform.org.uk/latest-news-and-research/publications/how-to-conduct-an-election-by-the-single-transferable-vote-3rd-edition/#sub-section-24) (official) | ✓ | +| ERS97 | [Reverse engineered ballot papers for the ERS97 model election](https://yingtongli.me/blog/2021/01/04/ers97.html) | [Model result](https://www.electoral-reform.org.uk/latest-news-and-research/publications/how-to-conduct-an-election-by-the-single-transferable-vote-3rd-edition/#sub-section-24) (official) | ✓ | +| ERS97 | [Joe Otten/eSTV ballot papers for the ERS97 model election](https://web.archive.org/web/20020606014623/http://estv.otten.co.uk/) | [Model result](https://www.electoral-reform.org.uk/latest-news-and-research/publications/how-to-conduct-an-election-by-the-single-transferable-vote-3rd-edition/#sub-section-24) (official) | ✓ | # References diff --git a/tests/data/ers97.blt b/tests/data/ers97.blt new file mode 100644 index 0000000..22a2444 --- /dev/null +++ b/tests/data/ers97.blt @@ -0,0 +1,71 @@ +# Comment: Ballot papers for the ERS97 model election - all votes - ERS97 +# Source: Joe Otten, bundled with eSTV 1.40 at https://web.archive.org/web/20020606014623/http://estv.otten.co.uk/ +# Contributor: RunasSudo +11 6 +8 1 2 0 +3 1 3 0 +14 1 4 0 +34 1 5 0 +1 1 6 0 +4 1 7 0 +1 1 8 0 +4 1 9 3 0 +3 1 9 4 0 +2 1 9 6 0 +3 1 9 7 0 +4 1 9 8 0 +9 1 9 0 +4 1 10 3 0 +5 1 10 4 0 +3 1 10 6 0 +3 1 10 7 0 +6 1 10 8 0 +10 1 10 0 +1 1 11 5 0 +1 1 11 0 +11 1 0 +105 2 0 +91 3 0 +90 4 0 +81 5 0 +64 6 0 +11 7 6 0 +36 7 8 0 +12 7 0 +55 8 0 +3 9 3 0 +2 9 4 0 +2 9 5 3 0 +1 9 5 4 0 +15 9 5 0 +2 9 6 0 +2 9 8 0 +2 10 3 0 +2 10 4 0 +2 10 5 6 0 +1 10 5 7 6 0 +2 10 5 8 0 +11 10 5 0 +1 10 6 0 +1 10 7 4 0 +1 10 8 0 +1 10 0 +2 11 2 0 +4 11 3 0 +1 11 4 0 +5 11 7 8 0 +10 11 8 0 +1 11 0 +0 +"Smith" +"Duke" +"Prince" +"Freeman" +"Carpenter" +"Baron" +"Abbot" +"Vicar" +"Wright" +"Glazier" +"Monk" +"ERS Model - 1997 Edition" diff --git a/tests/data/ers97.csv b/tests/data/ers97.csv new file mode 100644 index 0000000..c139f98 --- /dev/null +++ b/tests/data/ers97.csv @@ -0,0 +1,15 @@ +Stage:,1,,2,,4,,6,,7,,8, +Comment:,First preferences,,Surplus of Smith,,Exclusion of Monk,,"Exclusion of Glazier, Wright",,Surplus of Carpenter,,Exclusion of Abbot, +Smith,134,EL,107.58,EL,107.58,EL,107.58,EL,107.58,EL,107.58,EL +Duke,105,H,106.68,H,108.68,EL,108.68,EL,108.68,EL,108.68,EL +Prince,91,H,91.63,H,95.63,H,102.31,H,104.31,EL,104.31,EL +Freeman,90,H,92.94,H,93.94,H,99.62,H,100.62,H,101.62,EL +Carpenter,81,H,88.14,H,88.35,H,122.35,EL,107.58,EL,107.58,EL +Baron,64,H,64.21,H,64.21,H,68.26,H,70.26,H,82.26,H +Abbot,59,H,59.84,H,64.84,H,67.1,H,68.1,H,2.1,EX +Vicar,55,H,55.21,H,65.21,H,70.31,H,72.31,H,113.31,EL +Wright,27,H,32.25,H,32.25,H,0,EX,0,EX,0,EX +Glazier,24,H,30.51,H,30.51,H,0,EX,0,EX,0,EX +Monk,23,H,23.42,H,0,EX,0,EX,0,EX,0,EX +Non-transferable,0,,0.59,,1.8,,6.79,,13.56,,25.56, +Votes required,,,,,,,105.87,,104.13,,96.41, diff --git a/tests/data/ers97.ods b/tests/data/ers97.ods new file mode 100644 index 0000000..456f6f3 Binary files /dev/null and b/tests/data/ers97.ods differ diff --git a/tests/ers97.rs b/tests/ers97.rs index 5a38704..57f48dc 100644 --- a/tests/ers97.rs +++ b/tests/ers97.rs @@ -40,3 +40,24 @@ fn ers97old_rational() { utils::read_validate_election::("tests/data/ers97old.csv", "tests/data/ers97old.blt", stv_opts, None, &["nt", "vre"]); } + +#[test] +fn ers97_rational() { + let stv_opts = stv::STVOptionsBuilder::default() + .round_surplus_fractions(Some(2)) + .round_values(Some(2)) + .round_votes(Some(2)) + .round_quota(Some(2)) + .quota(stv::QuotaType::DroopExact) + .quota_criterion(stv::QuotaCriterion::GreaterOrEqual) + .quota_mode(stv::QuotaMode::ERS97) + .surplus(stv::SurplusMethod::EG) + .transferable_only(true) + .exclusion(stv::ExclusionMethod::ByValue) + .early_bulk_elect(false) + .bulk_exclude(true) + .defer_surpluses(true) + .build().unwrap(); + + utils::read_validate_election::("tests/data/ers97.csv", "tests/data/ers97.blt", stv_opts, None, &["nt", "vre"]); +}