2021-06-09 20:09:20 +10:00
|
|
|
/* 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://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
mod utils;
|
|
|
|
|
|
|
|
use opentally::numbers::Rational;
|
|
|
|
use opentally::stv;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn ers97_rational() {
|
|
|
|
let stv_opts = stv::STVOptions {
|
|
|
|
round_tvs: Some(2),
|
|
|
|
round_weights: Some(2),
|
|
|
|
round_votes: Some(2),
|
|
|
|
round_quota: Some(2),
|
2021-06-11 21:22:28 +10:00
|
|
|
sum_surplus_transfers: stv::SumSurplusTransfersMode::SingleStep,
|
2021-06-18 18:48:12 +10:00
|
|
|
meek_surplus_tolerance: String::new(),
|
2021-06-12 21:16:53 +10:00
|
|
|
normalise_ballots: false,
|
2021-06-09 20:09:20 +10:00
|
|
|
quota: stv::QuotaType::DroopExact,
|
|
|
|
quota_criterion: stv::QuotaCriterion::GreaterOrEqual,
|
|
|
|
quota_mode: stv::QuotaMode::ERS97,
|
2021-06-13 00:15:14 +10:00
|
|
|
ties: vec![],
|
2021-06-09 20:09:20 +10:00
|
|
|
surplus: stv::SurplusMethod::EG,
|
|
|
|
surplus_order: stv::SurplusOrder::BySize,
|
|
|
|
transferable_only: true,
|
|
|
|
exclusion: stv::ExclusionMethod::ByValue,
|
2021-06-20 01:37:51 +10:00
|
|
|
meek_nz_exclusion: false,
|
2021-06-23 00:52:25 +10:00
|
|
|
early_bulk_elect: true,
|
2021-06-09 20:09:20 +10:00
|
|
|
bulk_exclude: true,
|
|
|
|
defer_surpluses: true,
|
2021-06-18 18:48:12 +10:00
|
|
|
meek_immediate_elect: false,
|
2021-06-27 22:24:25 +10:00
|
|
|
constraints_path: None,
|
2021-06-27 21:57:24 +10:00
|
|
|
constraint_mode: stv::ConstraintMode::GuardDoom,
|
2021-06-09 20:09:20 +10:00
|
|
|
pp_decimals: 2,
|
|
|
|
};
|
2021-06-16 20:28:03 +10:00
|
|
|
utils::read_validate_election::<Rational>("tests/data/ers97.csv", "tests/data/ers97.blt", stv_opts, None, &["nt", "vre"]);
|
2021-06-09 20:09:20 +10:00
|
|
|
}
|