Add test case for Western Australia STV
This commit is contained in:
parent
4cf9053681
commit
582fdb8fe2
173
tests/data/WA2008-EastMetro-PartialReconstruction.blt
Normal file
173
tests/data/WA2008-EastMetro-PartialReconstruction.blt
Normal file
@ -0,0 +1,173 @@
|
||||
# Comment: 2008 Western Australia state election - ATL votes and partial reconstruction of some BTL votes - Western Australia STV
|
||||
# Source: https://www.elections.wa.gov.au/sites/default/files/content/documents/2008_SGE_Results_Stats_Part5.pdf, https://www.elections.wa.gov.au/elections/state/sgelection#/sg2008/region/01/results
|
||||
# Contributor: RunasSudo
|
||||
28 6
|
||||
# ATL
|
||||
7562 1 2 11 12 25 28 27 24 26 9 10 16 19 20 13 14 15 17 18 21 22 23 8 7 6 5 4 3 0 # A - Family First
|
||||
110821 3 4 5 6 7 8 21 22 23 26 27 24 28 1 2 11 12 13 14 15 16 17 18 19 20 9 10 25 0 # B - Australian Labor Party
|
||||
349 9 10 15 14 13 27 16 17 18 19 20 25 26 24 28 23 22 21 8 7 6 5 4 3 2 1 11 12 0 # C - Citizens Electoral Council
|
||||
7480 11 12 27 1 2 25 24 13 14 16 15 17 18 19 20 26 28 9 10 3 4 5 6 7 8 21 22 23 0 # D - Christian Democratic Party WA
|
||||
102138 13 14 15 16 17 18 11 12 19 20 1 2 24 27 26 28 21 22 23 9 10 3 4 5 6 7 8 25 0 # E - Liberal
|
||||
2331 19 20 11 12 1 2 25 13 14 15 16 17 18 24 26 27 3 4 5 6 7 8 21 22 23 9 10 28 0 # F - The Nationals
|
||||
29265 21 22 23 28 24 3 4 5 6 7 8 1 2 19 20 25 26 27 13 14 15 16 17 18 9 10 11 12 0 # G - Greens (WA)
|
||||
1425 24 19 20 4 8 17 12 21 22 23 27 26 28 11 7 6 5 3 18 16 15 14 13 2 1 25 10 9 0 # H - Independent
|
||||
1828 25 11 12 1 2 26 19 20 28 9 10 27 13 14 15 16 17 18 21 22 23 24 3 4 5 6 7 8 0 # I - One Nation
|
||||
429 26 6 7 8 27 24 28 25 21 22 23 3 4 5 9 10 19 20 13 14 15 16 17 18 1 2 11 12 0 # J - Independent
|
||||
192 27 11 12 1 2 25 19 20 9 10 3 4 5 6 7 8 13 14 15 16 17 18 26 24 21 22 23 28 0 # K - Independent
|
||||
1409 28 21 22 23 13 14 15 16 17 18 1 2 9 10 24 26 27 11 12 3 4 5 6 7 8 19 20 25 0 # L - Daylight Saving Party
|
||||
# BTL
|
||||
1140 1 0
|
||||
137 2 0
|
||||
36 3 1 0
|
||||
24 3 2 0
|
||||
6 3 4 1 0
|
||||
1 3 4 2 0
|
||||
954 3 4 5 0
|
||||
19 3 4 6 0
|
||||
7 3 4 7 0
|
||||
5 3 4 8 0
|
||||
1 3 4 17 0
|
||||
4 3 4 21 0
|
||||
104 3 5 0
|
||||
33 3 6 0
|
||||
22 3 7 0
|
||||
41 3 8 0
|
||||
2 3 9 0
|
||||
1 3 10 7 0
|
||||
3 3 11 0
|
||||
1 3 17 0
|
||||
1 3 18 0
|
||||
2 3 19 0
|
||||
12 3 21 0
|
||||
2 3 22 0
|
||||
1 3 28 0
|
||||
37 4 1 0
|
||||
25 4 2 0
|
||||
299 4 5 0
|
||||
42 4 6 0
|
||||
47 4 7 0
|
||||
31 4 8 0
|
||||
3 4 9 0
|
||||
1 4 10 1 0
|
||||
1 4 10 20 0
|
||||
2 4 11 0
|
||||
1 4 12 0
|
||||
2 4 15 0
|
||||
5 4 16 0
|
||||
1 4 19 0
|
||||
18 4 21 0
|
||||
3 4 22 0
|
||||
7 4 23 0
|
||||
1 4 25 0
|
||||
1 4 26 0
|
||||
2 4 27 0
|
||||
4 4 28 0
|
||||
368 5 0
|
||||
212 6 0
|
||||
227 7 0
|
||||
243 8 0
|
||||
47 9 0
|
||||
2 10 1 0
|
||||
1 10 5 0
|
||||
1 10 6 0
|
||||
1 10 8 0
|
||||
9 10 9 0
|
||||
1 10 11 0
|
||||
1 10 15 0
|
||||
1 10 19 0
|
||||
1 10 21 0
|
||||
1 10 23 0
|
||||
2 10 27 0
|
||||
514 11 0
|
||||
100 12 0
|
||||
17 13 1 0
|
||||
1 13 2 0
|
||||
2 13 5 0
|
||||
4 13 8 0
|
||||
4 13 9 0
|
||||
1 13 10 18 0
|
||||
5 13 11 0
|
||||
1 13 12 0
|
||||
4 13 14 1 0
|
||||
1 13 14 5 0
|
||||
1 13 14 6 0
|
||||
1 13 14 7 0
|
||||
3 13 14 11 0
|
||||
1 13 14 12 0
|
||||
1057 13 14 15 0
|
||||
20 13 14 16 0
|
||||
3 13 14 17 0
|
||||
6 13 14 18 0
|
||||
4 13 14 19 0
|
||||
4 13 14 21 0
|
||||
57 13 15 0
|
||||
38 13 16 0
|
||||
11 13 17 0
|
||||
22 13 18 0
|
||||
9 13 19 0
|
||||
1 13 20 0
|
||||
3 13 21 0
|
||||
1 13 22 0
|
||||
1 13 24 0
|
||||
3 13 28 0
|
||||
9 14 1 0
|
||||
1 14 7 0
|
||||
1 14 8 0
|
||||
1 14 9 0
|
||||
1 14 10 1 0
|
||||
3 14 11 0
|
||||
7 14 12 0
|
||||
68 14 15 0
|
||||
15 14 16 0
|
||||
9 14 17 0
|
||||
10 14 18 0
|
||||
4 14 19 0
|
||||
1 14 20 0
|
||||
3 14 21 0
|
||||
1 14 25 0
|
||||
2 14 28 0
|
||||
201 15 0
|
||||
234 16 0
|
||||
85 17 0
|
||||
305 18 0
|
||||
315 19 0
|
||||
44 20 0
|
||||
2379 21 0
|
||||
284 22 0
|
||||
300 23 0
|
||||
299 24 0
|
||||
223 25 0
|
||||
85 26 0
|
||||
106 27 0
|
||||
256 28 0
|
||||
9319 0
|
||||
0
|
||||
"BOLT, Stephen Charles" # 1 - Family First
|
||||
"HOPKINSON, Symia Joyce" # 2
|
||||
"FERGUSON, John Rilday" # 3 - Australian Labor Party
|
||||
"RAVLICH, Ljiljanna Maria" # 4
|
||||
"SAVAGE, Linda Rosmary" # 5
|
||||
"CARSON, Gary John" # 6
|
||||
"BURTON, Carolyn Anne" # 7
|
||||
"COMRIE, Craig Hugh John" # 8
|
||||
"VINCENT, Neil Allen" # 9 - Citizens Electoral Council
|
||||
"PASSMORE, Theresa" # 10
|
||||
"RANDALL, Dwight Allan" # 11 - Christian Democratic Party WA
|
||||
"GOIRAN, Gerard Pierre" # 12
|
||||
"MORTON, Helen Margaret" # 13 - Liberal
|
||||
"FARAGHER, Donna Evelyn Mary" # 14
|
||||
"HAYDEN, Alyssa Kathleen" # 15
|
||||
"BLIZARD, Stephen Michael" # 16
|
||||
"TREASE, Darryl Raymond" # 17
|
||||
"SIMPSON, Guy Julian" # 18
|
||||
"WOOD, Sean Damian" # 19 - The Nationals
|
||||
"MANGINI, Kevin Leonard Raymond" # 20
|
||||
"XAMON, Alison Marie" # 21 - Greens (WA)
|
||||
"WOLFF, Stephen Karl" # 22
|
||||
"DOUGLAS-MEYER, Damian Paul" # 23
|
||||
"HOYER, Thomas Harry John" # 24 - Independent
|
||||
"HOPKINSON, James Peter" # 25 - One Nation
|
||||
"NASH, Richard Paul" # 26 - Independent
|
||||
"TUCAK, John Damien" # 27 - Independent
|
||||
"DAY, Conor Patrick" # 28 - Daylight Saving Party
|
||||
"WA 2008 State General Election East Metropolitan Region"
|
32
tests/data/WA2008-EastMetro-PartialReconstruction.csv
Normal file
32
tests/data/WA2008-EastMetro-PartialReconstruction.csv
Normal file
@ -0,0 +1,32 @@
|
||||
Stage:,1,,2,,3,,4,,5,,6,,7,,8,,9,,10,
|
||||
Comment:,First preferences,,"Surplus of FERGUSON, John Rilday",,"Surplus of MORTON, Helen Margaret",,"Surplus of RAVLICH, Ljiljanna Maria",,"Surplus of FARAGHER, Donna Evelyn Mary",,"Exclusion of PASSMORE, Theresa",,"Exclusion of PASSMORE, Theresa",,"Exclusion of PASSMORE, Theresa",,"Exclusion of PASSMORE, Theresa",,"Exclusion of PASSMORE, Theresa",
|
||||
"BOLT, Stephen Charles",8702,H,8725,H,8735,H,8752,H,8755,H,8757,H,8757,H,8757,H,8757,H,8757,H
|
||||
"HOPKINSON, Symia Joyce",137,H,152,H,152,H,163,H,163,H,163,H,163,H,163,H,163,H,163,H
|
||||
"FERGUSON, John Rilday",112103,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL
|
||||
"RAVLICH, Ljiljanna Maria",533,H,72937,EL,72937,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL
|
||||
"SAVAGE, Linda Rosmary",368,H,435,H,436,H,33739,H,33739,H,33740,H,33740,H,33740,H,33740,H,33740,H
|
||||
"CARSON, Gary John",212,H,233,H,233,H,257,H,257,H,258,H,258,H,258,H,258,H,258,H
|
||||
"BURTON, Carolyn Anne",227,H,241,H,241,H,264,H,264,H,264,H,264,H,264,H,264,H,264,H
|
||||
"COMRIE, Craig Hugh John",243,H,269,H,271,H,286,H,286,H,287,H,287,H,287,H,287,H,287,H
|
||||
"VINCENT, Neil Allen",396,H,397,H,399,H,400,H,400,H,409,H,409,H,409,H,409,H,409,H
|
||||
"PASSMORE, Theresa",21,H,21,H,21,H,21,H,21,H,,EX,,EX,,EX,,EX,0,EX
|
||||
"RANDALL, Dwight Allan",7994,H,7995,H,7998,H,7998,H,7999,H,8000,H,8000,H,8000,H,8000,H,8000,H
|
||||
"GOIRAN, Gerard Pierre",100,H,100,H,100,H,100,H,102,H,102,H,102,H,102,H,102,H,102,H
|
||||
"MORTON, Helen Margaret",103424,EL,103424,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL
|
||||
"FARAGHER, Donna Evelyn Mary",136,H,136,H,63934,EL,63934,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL,39514,EL
|
||||
"HAYDEN, Alyssa Kathleen",201,H,201,H,236,H,236,H,24617,H,24618,H,24618,H,24618,H,24618,H,24618,H
|
||||
"BLIZARD, Stephen Michael",234,H,234,H,257,H,259,H,268,H,268,H,268,H,268,H,268,H,268,H
|
||||
"TREASE, Darryl Raymond",85,H,85,H,91,H,91,H,94,H,94,H,94,H,94,H,94,H,94,H
|
||||
"SIMPSON, Guy Julian",305,H,305,H,318,H,318,H,322,H,322,H,322,H,322,H,322,H,322,H
|
||||
"WOOD, Sean Damian",2646,H,2647,H,2652,H,2652,H,2653,H,2654,H,2654,H,2654,H,2654,H,2654,H
|
||||
"MANGINI, Kevin Leonard Raymond",44,H,44,H,44,H,44,H,44,H,44,H,44,H,44,H,44,H,44,H
|
||||
"XAMON, Alison Marie",31644,H,31651,H,31652,H,31661,H,31662,H,31663,H,31663,H,31663,H,31663,H,31663,H
|
||||
"WOLFF, Stephen Karl",284,H,285,H,285,H,286,H,286,H,286,H,286,H,286,H,286,H,286,H
|
||||
"DOUGLAS-MEYER, Damian Paul",300,H,300,H,300,H,303,H,303,H,304,H,304,H,304,H,304,H,304,H
|
||||
"HOYER, Thomas Harry John",1724,H,1724,H,1724,H,1724,H,1724,H,1724,H,1724,H,1724,H,1724,H,1724,H
|
||||
"HOPKINSON, James Peter",2051,H,2051,H,2051,H,2051,H,2051,H,2051,H,2051,H,2051,H,2051,H,2051,H
|
||||
"NASH, Richard Paul",514,H,514,H,514,H,514,H,514,H,514,H,514,H,514,H,514,H,514,H
|
||||
"TUCAK, John Damien",298,H,298,H,298,H,298,H,298,H,300,H,300,H,300,H,300,H,300,H
|
||||
"DAY, Conor Patrick",1665,H,1665,H,1666,H,1667,H,1667,H,1667,H,1667,H,1667,H,1667,H,1667,H
|
||||
Exhausted,9319,,9319,,9319,,9319,,9319,,9319,,9319,,9319,,9319,,9319,
|
||||
Loss by fraction,0,,8,,18,,31,,46,,,,,,,,,,46,
|
|
BIN
tests/data/WA2008-EastMetro-PartialReconstruction.ods
Normal file
BIN
tests/data/WA2008-EastMetro-PartialReconstruction.ods
Normal file
Binary file not shown.
43
tests/tests_impl/wa.rs
Normal file
43
tests/tests_impl/wa.rs
Normal file
@ -0,0 +1,43 @@
|
||||
/* OpenTally: Open-source election vote counting
|
||||
* Copyright © 2021–2023 Lee Yingtong Li (RunasSudo)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Compare results under Western Australia STV with official results from WA Electoral Commission
|
||||
// Using (partially) reconstructed ballot papers
|
||||
|
||||
use crate::utils;
|
||||
|
||||
use opentally::numbers::Rational;
|
||||
use opentally::stv;
|
||||
|
||||
#[test]
|
||||
fn wa_eastmetro08_rational() {
|
||||
// Validates only up to stage 10 (Exclusion of PASSMORE, Theresa)
|
||||
|
||||
let stv_opts = stv::STVOptionsBuilder::default()
|
||||
.round_votes(Some(0))
|
||||
.round_quota(Some(0))
|
||||
.round_subtransfers(stv::RoundSubtransfersMode::ByParcel)
|
||||
.quota_criterion(stv::QuotaCriterion::GreaterOrEqual)
|
||||
.exclusion(stv::ExclusionMethod::ParcelsByOrder)
|
||||
.surplus_order(stv::SurplusOrder::ByOrder)
|
||||
.surplus_assume_total(true)
|
||||
.build().unwrap();
|
||||
|
||||
assert_eq!(stv_opts.describe::<Rational>(), "--round-votes 0 --round-quota 0 --round-subtransfers by_parcel --quota-criterion geq --ties backwards random --random-seed 20220322 --surplus-order by_order --surplus-assume-total --exclusion parcels_by_order");
|
||||
|
||||
utils::read_validate_election::<Rational>("tests/data/WA2008-EastMetro-PartialReconstruction.csv", "tests/data/WA2008-EastMetro-PartialReconstruction.blt", stv_opts, None, &["exhausted", "lbf"]);
|
||||
}
|
Loading…
Reference in New Issue
Block a user