Add test case (Dail-like rules) from Grey-Fitzgerald ERS booklet

This commit is contained in:
RunasSudo 2021-09-26 02:27:50 +10:00
parent cf75943829
commit 0506283ae4
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
4 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,46 @@
# Comment: Ballot papers derived from the Grey-Fitzgerald (1955) model election - all votes - Dail-like rules
# Source: RunasSudo
# Contributor: RunasSudo
11 6
5 1 7 3
27 2 4
2 2 4 1
2 2 4 5
43 2 4 9
5 2 4 10
1 2 4 0
2 2 5
25 2 9
10 2 10
4 2 10 3
4 2 10 9 3
3 2 10 9 11
8 2 10 9 0
4 2 0
25 3
10 4
1 5 7 3
3 5 9
1 5 10 11
50 6 0 # ??
9 6 11
2 6 3
1 6 1 7 3
12 7 11
2 7
50 8
13 9
24 11
0
"A" # 1
"B" # 2
"C" # 3
"D" # 4
"E" # 5
"F" # 6
"G" # 7
"H" # 8
"J" # 9
"K" # 10
"L" # 11
"GreyFitzgerald Example"

View File

@ -0,0 +1,14 @@
Stage:,1,,2,,3,,4,,5,,6,,7,,8,
Comment:,First preferences,,Surplus of B,,Surplus of D,,Surplus of F,,"Exclusion of A, E",,Exclusion of K,,Exclusion of G,,Surplus of J,
A,5,H,5,H,5,H,6,H,0,EX,0,EX,0,EX,0,EX
B,140,EL,50,EL,50,EL,50,EL,50,EL,50,EL,50,EL,50,EL
C,25,H,25,H,25,H,27,H,27,H,31,H,38,H,42,H
D,10,H,63,EL,50,EL,50,EL,50,EL,50,EL,50,EL,50,EL
E,5,H,6,H,7,H,7,H,0,EX,0,EX,0,EX,0,EX
F,62,EL,62,EL,62,EL,50,EL,50,EL,50,EL,50,EL,50,EL
G,14,H,14,H,14,H,14,H,21,H,21,H,0,EX,0,EX
H,50,EL,50,EL,50,EL,50,EL,50,EL,50,EL,50,EL,50,EL
J,13,H,30,H,41,H,41,H,44,H,59,EL,59,EL,50,EL
K,0,H,19,H,20,H,20,H,21,H,0,EX,0,EX,0,EX
L,24,H,24,H,24,H,33,H,33,H,34,H,46,H,49,EL
Non-transferable,0,,0,,0,,0,,2,,3,,5,,7,
1 Stage: 1 2 3 4 5 6 7 8
2 Comment: First preferences Surplus of B Surplus of D Surplus of F Exclusion of A, E Exclusion of K Exclusion of G Surplus of J
3 A 5 H 5 H 5 H 6 H 0 EX 0 EX 0 EX 0 EX
4 B 140 EL 50 EL 50 EL 50 EL 50 EL 50 EL 50 EL 50 EL
5 C 25 H 25 H 25 H 27 H 27 H 31 H 38 H 42 H
6 D 10 H 63 EL 50 EL 50 EL 50 EL 50 EL 50 EL 50 EL
7 E 5 H 6 H 7 H 7 H 0 EX 0 EX 0 EX 0 EX
8 F 62 EL 62 EL 62 EL 50 EL 50 EL 50 EL 50 EL 50 EL
9 G 14 H 14 H 14 H 14 H 21 H 21 H 0 EX 0 EX
10 H 50 EL 50 EL 50 EL 50 EL 50 EL 50 EL 50 EL 50 EL
11 J 13 H 30 H 41 H 41 H 44 H 59 EL 59 EL 50 EL
12 K 0 H 19 H 20 H 20 H 21 H 0 EX 0 EX 0 EX
13 L 24 H 24 H 24 H 33 H 33 H 34 H 46 H 49 EL
14 Non-transferable 0 0 0 0 2 3 5 7

Binary file not shown.

View File

@ -19,6 +19,7 @@ use crate::utils;
use opentally::numbers::Rational;
use opentally::stv;
use opentally::ties::TieStrategy;
#[test]
fn dublin_north_2002_rational() {
@ -36,3 +37,22 @@ fn dublin_north_2002_rational() {
utils::read_validate_election::<Rational>("tests/data/DublinNorthSorted.csv", "tests/data/DublinNorthSorted.blt", stv_opts, None, &["exhausted"]);
}
#[test]
fn grey_fitzgerald_rational() {
let stv_opts = stv::STVOptionsBuilder::default()
.round_quota(Some(0))
.normalise_ballots(true)
.quota_criterion(stv::QuotaCriterion::GreaterOrEqual)
.ties(vec![TieStrategy::Forwards])
.surplus(stv::SurplusMethod::Hare)
.surplus_order(stv::SurplusOrder::BySize) // Differs to Dail
.transferable_only(true)
.bulk_exclude(true)
.defer_surpluses(true)
.build().unwrap();
assert_eq!(stv_opts.describe::<Rational>(), "--round-quota 0 --normalise-ballots --quota-criterion geq --ties forwards --surplus hare --transferable-only --bulk-exclude --defer-surpluses");
utils::read_validate_election::<Rational>("tests/data/grey_fitzgerald.csv", "tests/data/grey_fitzgerald.blt", stv_opts, None, &["exhausted"]);
}