/* OpenTally: Open-source election vote counting
* Copyright © 2021 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://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
use opentally::election::{CandidateState, CountState, Election};
use opentally::numbers::{Fixed, GuardedFixed, Number};
use opentally::stv;
use xmltree::Element;
use std::io::{self, BufRead};
use std::fs::File;
use std::ops;
#[test]
fn scotland_linn07_fixed5() {
let stv_opts = stv::STVOptions {
round_tvs: Some(5),
round_weights: Some(5),
round_votes: Some(5),
round_quota: Some(0),
sum_surplus_transfers: stv::SumSurplusTransfersMode::PerBallot,
meek_surplus_tolerance: String::new(),
normalise_ballots: true,
quota: stv::QuotaType::Droop,
quota_criterion: stv::QuotaCriterion::GreaterOrEqual,
quota_mode: stv::QuotaMode::Static,
ties: vec![],
surplus: stv::SurplusMethod::WIG,
surplus_order: stv::SurplusOrder::BySize,
transferable_only: false,
exclusion: stv::ExclusionMethod::SingleStage,
meek_nz_exclusion: false,
early_bulk_elect: true,
bulk_exclude: false,
defer_surpluses: false,
meek_immediate_elect: false,
constraints_path: None,
constraint_mode: stv::ConstraintMode::GuardDoom,
pp_decimals: 5,
};
Fixed::set_dps(5);
scotland_linn07::(stv_opts);
}
#[test]
fn scotland_linn07_gfixed5() {
let stv_opts = stv::STVOptions {
round_tvs: Some(5),
round_weights: Some(5),
round_votes: Some(5),
round_quota: Some(0),
sum_surplus_transfers: stv::SumSurplusTransfersMode::PerBallot,
meek_surplus_tolerance: String::new(),
normalise_ballots: true,
quota: stv::QuotaType::Droop,
quota_criterion: stv::QuotaCriterion::GreaterOrEqual,
quota_mode: stv::QuotaMode::Static,
ties: vec![],
surplus: stv::SurplusMethod::WIG,
surplus_order: stv::SurplusOrder::BySize,
transferable_only: false,
exclusion: stv::ExclusionMethod::SingleStage,
meek_nz_exclusion: false,
early_bulk_elect: true,
bulk_exclude: false,
defer_surpluses: false,
meek_immediate_elect: false,
constraints_path: None,
constraint_mode: stv::ConstraintMode::GuardDoom,
pp_decimals: 5,
};
GuardedFixed::set_dps(5);
scotland_linn07::(stv_opts);
}
fn scotland_linn07(stv_opts: stv::STVOptions)
where
for<'r> &'r N: ops::Add<&'r N, Output=N>,
for<'r> &'r N: ops::Sub<&'r N, Output=N>,
for<'r> &'r N: ops::Mul<&'r N, Output=N>,
for<'r> &'r N: ops::Div<&'r N, Output=N>,
for<'r> &'r N: ops::Neg