Lot S, phase 2 : le quorum dans le moteur (ADR 0013), vu rouge puis vert
Le quorum Q (votants = pour + contre) remplace le C additif : T' = max(T, Q), la version passe si pour ≥ ⌈B^W + ratio(T')·T'⌉, ratio la courbe des cinq crans (M, G calé à la participation de référence, inchangé). La règle d'Yvv du 03/11 (« Ils comptent comme non ») est seule dans threshold::judged_voters. Pour l'écran : yes_needed (le total de pour qui passe avec les contre d'aujourd'hui) et no_needed (le total de contre qui tient les pour d'aujourd'hui, 0 si le quorum suffit) ; passe ⇔ pour ≥ yesNeeded ⇔ contre < noNeeded, éprouvé sur une grille. well_rated : la part tient sur ceux qui sont venus. Scale porte les quorums par cran, UnitState le quorum propre d'un article ; p0 reste 2·vote_floor/W. Vu rouge : sans la règle (T' = T), 9 tests échouent ; avec l'autre lecture d'un quorum (un minimum de votants, les absents non comptés), 8 échouent, dont « un contre n'aide jamais ». Chiffres de contrôle (W 5 707, p0 = 100/W) tenus : 9, 39, 46 au quorum ; 7, 8, 9, 9, 10 à dix votants. Le serveur suit au commit suivant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+138
-70
@@ -5,20 +5,25 @@
|
||||
//! médiane aux votes du groupe » — the scale chosen is « calée sur la
|
||||
//! participation ».
|
||||
//!
|
||||
//! The formula stays the Ğ1 one (`threshold`); only M and G depend on the
|
||||
//! level k:
|
||||
//! The formula stays the Ğ1 one (`threshold`); M, G and the quorum Q depend on
|
||||
//! the level k:
|
||||
//!
|
||||
//! - M_k, the majority at full participation: 50, 50, 55, 60, 66 %;
|
||||
//! - s_k, the share of *for* votes asked **beyond C** at the group's usual
|
||||
//! - s_k, the share of *for* votes asked of the voters at the group's usual
|
||||
//! participation p̃: 60, 67, 75, 83, 90 %;
|
||||
//! - G_k follows from `s_k = M_k + (1 − M_k)(1 − p̃^G_k)`:
|
||||
//! `G_k = ln(1 − (s_k − M_k)/(1 − M_k)) / ln(p̃)`.
|
||||
//! `G_k = ln(1 − (s_k − M_k)/(1 − M_k)) / ln(p̃)`;
|
||||
//! - Q_k, the quorum of the level, set by the document (Monnaie libre: 12, 12,
|
||||
//! 50, 50, 50; the test group: 1 everywhere — ADR 0013); an article may hold its
|
||||
//! own, set by its author before the first vote (`Scale::quorum`).
|
||||
//!
|
||||
//! p̃ is the median number of voters on the group's proposals, over W
|
||||
//! (`Participation`). Until the group has voted on enough proposals, a
|
||||
//! reference `p0 = 2C/W` stands in. Both are kept within [1 %, 50 %]: ln(p̃)
|
||||
//! stays negative and finite, so G is finite and positive, and the threshold
|
||||
//! rises with the level and relaxes toward M as participation grows.
|
||||
//! reference `p0 = 2Q₀/W` stands in, Q₀ the document's reference quorum (its
|
||||
//! `vote_floor`, never an article's quorum: an author who lowers his would move
|
||||
//! the curve of everyone). Both are kept within [1 %, 50 %]: ln(p̃) stays
|
||||
//! negative and finite, so G is finite and positive, and the threshold rises
|
||||
//! with the level and relaxes toward M as participation grows.
|
||||
|
||||
use crate::threshold::{Evaluation, FormulaParams, Tally, ThresholdError, evaluate};
|
||||
use serde::de::Error as _;
|
||||
@@ -57,7 +62,7 @@ impl InertiaLevel {
|
||||
MAJORITY_PCT[self.index()]
|
||||
}
|
||||
|
||||
/// s_k, in percent: the share of *for* asked beyond C at the usual participation.
|
||||
/// s_k, in percent: the share of *for* asked at the usual participation.
|
||||
pub fn share_pct(self) -> f64 {
|
||||
SHARE_PCT[self.index()]
|
||||
}
|
||||
@@ -115,7 +120,7 @@ impl<'de> Deserialize<'de> for InertiaLevel {
|
||||
pub enum ParticipationSource {
|
||||
/// The median of the group's voted proposals.
|
||||
Median,
|
||||
/// Too few voted proposals yet: `p0 = 2C/W`.
|
||||
/// Too few voted proposals yet: `p0 = 2Q₀/W`, Q₀ the document's reference quorum.
|
||||
Reference,
|
||||
}
|
||||
|
||||
@@ -140,18 +145,19 @@ impl Participation {
|
||||
pub const LOWEST: f64 = 0.01;
|
||||
pub const HIGHEST: f64 = 0.5;
|
||||
|
||||
/// `2C/W`, before the bounds: the floor twice over, a participation the
|
||||
/// group must reach anyway for C to leave room to the majority.
|
||||
pub fn reference_ratio(electorate: u32, floor: f64) -> f64 {
|
||||
2.0 * floor.max(0.0) / f64::from(electorate.max(1))
|
||||
/// `2Q₀/W`, before the bounds: the reference quorum of the document twice
|
||||
/// over (`documents.vote_floor`: 50 in Monnaie libre, 100 voters). It never
|
||||
/// rests on an article's quorum, which its author may lower (ADR 0013).
|
||||
pub fn reference_ratio(electorate: u32, reference_quorum: f64) -> f64 {
|
||||
2.0 * reference_quorum.max(0.0) / f64::from(electorate.max(1))
|
||||
}
|
||||
|
||||
/// p̃ from what was measured: the median when it rests on enough proposals,
|
||||
/// the reference otherwise; brought back within the bounds.
|
||||
pub fn of(electorate: u32, floor: f64, median: Option<f64>, sample: u32) -> Self {
|
||||
pub fn of(electorate: u32, reference_quorum: f64, median: Option<f64>, sample: u32) -> Self {
|
||||
let (raw, source) = match median {
|
||||
Some(m) if sample >= Self::MIN_SAMPLE => (m / f64::from(electorate.max(1)), ParticipationSource::Median),
|
||||
_ => (Self::reference_ratio(electorate, floor), ParticipationSource::Reference),
|
||||
_ => (Self::reference_ratio(electorate, reference_quorum), ParticipationSource::Reference),
|
||||
};
|
||||
let ratio = bounded(raw);
|
||||
Self { ratio, source, sample, median, bounded: ratio != raw }
|
||||
@@ -190,35 +196,44 @@ pub fn gradient(level: InertiaLevel, participation: f64) -> f64 {
|
||||
(1.0 - (s - m) / (1.0 - m)).ln() / bounded(participation).ln()
|
||||
}
|
||||
|
||||
/// What the votes of a group are judged by: its electorate W, its floor C and
|
||||
/// its usual participation p̃.
|
||||
/// What the votes of a document are judged by: its electorate W, its usual
|
||||
/// participation p̃ and the quorum of each level.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Scale {
|
||||
pub electorate: u32,
|
||||
pub floor: f64,
|
||||
/// p̃.
|
||||
pub participation: f64,
|
||||
/// Q_k, the quorum of each level, 1 to 5: the default of an article at that level.
|
||||
pub quorums: [u32; 5],
|
||||
}
|
||||
|
||||
impl Scale {
|
||||
/// The letters of the formula for a level.
|
||||
pub fn params(&self, level: InertiaLevel) -> FormulaParams {
|
||||
/// The quorum an article is judged on: its own, set by its author before the first
|
||||
/// vote, else the one of its level (Yvv, 2026-11-02: « C suit le cran, mais c'est une
|
||||
/// proposition par défaut, variable modifiable par l'auteur initial du texte »). A
|
||||
/// change of inertia inherits the level of its article, and so its quorum.
|
||||
pub fn quorum(&self, level: InertiaLevel, own: Option<u32>) -> u32 {
|
||||
own.unwrap_or(self.quorums[level.index()])
|
||||
}
|
||||
|
||||
/// The letters of the formula for a level, on a quorum.
|
||||
pub fn params(&self, level: InertiaLevel, quorum: u32) -> FormulaParams {
|
||||
FormulaParams {
|
||||
majority_pct: level.majority_pct(),
|
||||
gradient: gradient(level, self.participation),
|
||||
base: FormulaParams::DEFAULT_BASE,
|
||||
constant: self.floor,
|
||||
quorum,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn evaluate(&self, tally: Tally, level: InertiaLevel) -> Result<Evaluation, ThresholdError> {
|
||||
evaluate(tally, self.electorate, &self.params(level))
|
||||
pub fn evaluate(&self, tally: Tally, level: InertiaLevel, quorum: u32) -> Result<Evaluation, ThresholdError> {
|
||||
evaluate(tally, self.electorate, &self.params(level, quorum))
|
||||
}
|
||||
|
||||
/// ⌈R⌉ for a level at `cast` votes.
|
||||
pub fn required(&self, cast: u32, level: InertiaLevel) -> Result<u32, ThresholdError> {
|
||||
crate::threshold::wot_threshold(self.electorate, cast, &self.params(level))
|
||||
/// ⌈R⌉ for a level and a quorum at `cast` votes.
|
||||
pub fn required(&self, cast: u32, level: InertiaLevel, quorum: u32) -> Result<u32, ThresholdError> {
|
||||
crate::threshold::wot_threshold(self.electorate, cast, &self.params(level, quorum))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,14 +243,22 @@ mod tests {
|
||||
use crate::threshold::required_ratio;
|
||||
|
||||
const W: u32 = 7224;
|
||||
const C: f64 = 50.0;
|
||||
/// The reference quorum of Monnaie libre (`vote_floor`): p0 = 2 × 50 / W.
|
||||
const Q0: f64 = 50.0;
|
||||
/// The quorums of Monnaie libre by level (Yvv, 2026-11-02: « 12 · 12 · 50 · 50 · 50 »).
|
||||
const QUORUMS: [u32; 5] = [12, 12, 50, 50, 50];
|
||||
|
||||
fn at_median(voters: u32) -> Scale {
|
||||
Scale { electorate: W, floor: C, participation: f64::from(voters) / f64::from(W) }
|
||||
fn level(k: u8) -> InertiaLevel {
|
||||
InertiaLevel::new(k).expect("1 to 5")
|
||||
}
|
||||
|
||||
fn at_median(voters: u32) -> Scale {
|
||||
Scale { electorate: W, participation: f64::from(voters) / f64::from(W), quorums: QUORUMS }
|
||||
}
|
||||
|
||||
/// ⌈R⌉ at `cast` votes, each level on its own quorum.
|
||||
fn row(scale: &Scale, cast: u32) -> Vec<u32> {
|
||||
InertiaLevel::ALL.iter().map(|k| scale.required(cast, *k).expect("valid")).collect()
|
||||
InertiaLevel::ALL.iter().map(|k| scale.required(cast, *k, scale.quorum(*k, None)).expect("valid")).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -265,30 +288,48 @@ mod tests {
|
||||
assert_eq!(serde_json::to_string(&InertiaLevel::HIGHEST).expect("json"), "5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_control_figures_of_the_quorum() {
|
||||
// W 5 707, before any median: p0 = 2 × 50 / W = 100 / W (orch, 2026-11-03).
|
||||
let w = 5707;
|
||||
let scale = Scale { electorate: w, participation: Participation::of(w, Q0, None, 0).ratio, quorums: QUORUMS };
|
||||
let yes = |k: u8, q: u32, against: u32| {
|
||||
crate::threshold::yes_needed(against, w, &scale.params(level(k), q)).expect("valid")
|
||||
};
|
||||
// At the quorum: level 2, Q 12 → 9 « pour »; level 3, Q 50 → 39; level 5, Q 50 → 46.
|
||||
assert_eq!((yes(2, 12, 0), yes(3, 50, 0), yes(5, 50, 0)), (9, 39, 46));
|
||||
// 9 « pour » pass at level 2 with 3 « contre » at most (Yvv, 2026-11-03); with a 4th,
|
||||
// 14 voters, 11 « pour » are asked (73,8 % of 14 is 10,2).
|
||||
assert_eq!((yes(2, 12, 3), yes(2, 12, 4)), (9, 11));
|
||||
// Ten voters, no quorum in the way: 7, 8, 9, 9 and 10 « pour », level 1 to 5.
|
||||
let ten: Vec<u32> = InertiaLevel::ALL.iter().map(|k| scale.required(10, *k, 1).expect("valid")).collect();
|
||||
assert_eq!(ten, [7, 8, 9, 9, 10]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_values_shown_to_yvv() {
|
||||
// W 7224, C 50, a median of 120 voters (the smith vote of 2024).
|
||||
// W 7224, quorums 12 · 12 · 50 · 50 · 50, a median of 120 voters (the smith vote of 2024).
|
||||
let scale = at_median(120);
|
||||
assert_eq!(row(&scale, 120), [92, 97, 103, 109, 113]);
|
||||
assert_eq!(row(&scale, 500), [306, 329, 362, 397, 432]);
|
||||
assert_eq!(row(&scale, 2000), [1091, 1145, 1271, 1404, 1549]);
|
||||
assert_eq!(row(&scale, 120), [72, 81, 90, 100, 108]);
|
||||
assert_eq!(row(&scale, 500), [284, 310, 347, 386, 424]);
|
||||
assert_eq!(row(&scale, 2000), [1068, 1123, 1252, 1389, 1537]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_median_of_360_voters() {
|
||||
let scale = at_median(360);
|
||||
assert_eq!(row(&scale, 120), [95, 101, 106, 112, 116]);
|
||||
assert_eq!(row(&scale, 360), [236, 258, 283, 308, 329]);
|
||||
assert_eq!(row(&scale, 500), [316, 345, 381, 416, 449]);
|
||||
assert_eq!(row(&scale, 2000), [1114, 1184, 1318, 1460, 1608]);
|
||||
assert_eq!(row(&scale, 120), [76, 86, 96, 106, 113]);
|
||||
assert_eq!(row(&scale, 360), [216, 242, 270, 299, 324]);
|
||||
assert_eq!(row(&scale, 500), [296, 328, 367, 407, 443]);
|
||||
assert_eq!(row(&scale, 2000), [1092, 1164, 1301, 1446, 1598]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn at_the_usual_participation_the_share_beyond_c_is_s_k() {
|
||||
for (w, c, voters) in [(7224, 50.0, 120), (7224, 50.0, 360), (5745, 50.0, 300), (40, 1.0, 9), (2, 1.0, 1)] {
|
||||
let scale = Scale { electorate: w, floor: c, participation: f64::from(voters) / f64::from(w) };
|
||||
fn at_the_usual_participation_the_share_is_s_k() {
|
||||
for (w, voters) in [(7224, 120), (7224, 360), (5745, 300), (40, 9), (2, 1)] {
|
||||
let scale = Scale { electorate: w, participation: f64::from(voters) / f64::from(w), quorums: QUORUMS };
|
||||
for k in InertiaLevel::ALL {
|
||||
let ratio = required_ratio(w, voters, &scale.params(k));
|
||||
let ratio = required_ratio(w, voters, &scale.params(k, 0));
|
||||
assert!((ratio - k.share_pct() / 100.0).abs() < 1e-12, "W {w}, k {}: {ratio}", k.get());
|
||||
}
|
||||
}
|
||||
@@ -296,26 +337,33 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn a_threshold_landing_on_a_whole_number_stays_on_it() {
|
||||
// Level 5 at the median: 90 % of the 70 votes beyond C is exactly 63.
|
||||
assert_eq!(at_median(120).required(120, InertiaLevel::HIGHEST), Ok(113));
|
||||
// Level 1: 60 % of 70 is exactly 42.
|
||||
assert_eq!(at_median(120).required(120, InertiaLevel::LOWEST), Ok(92));
|
||||
// Level 5 at the median: 90 % of 120 voters is exactly 108.
|
||||
assert_eq!(at_median(120).required(120, InertiaLevel::HIGHEST, 50), Ok(108));
|
||||
// Level 1: 60 % of 120 is exactly 72.
|
||||
assert_eq!(at_median(120).required(120, InertiaLevel::LOWEST, 12), Ok(72));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_threshold_rises_with_the_level() {
|
||||
for (w, c) in [(7224, 50.0), (5745, 50.0), (40, 1.0), (2, 1.0), (1, 1.0)] {
|
||||
for (w, q0, quorums) in [
|
||||
(7224, Q0, QUORUMS),
|
||||
(5745, Q0, QUORUMS),
|
||||
(5745, Q0, [50; 5]),
|
||||
(40, 1.0, [1; 5]),
|
||||
(2, 1.0, [1; 5]),
|
||||
(1, 1.0, [1; 5]),
|
||||
] {
|
||||
for voters in [1, 2, 9, 60, 120, 360, 3000] {
|
||||
let scale = Scale {
|
||||
electorate: w,
|
||||
floor: c,
|
||||
participation: Participation::of(w, c, Some(f64::from(voters)), 9).ratio,
|
||||
participation: Participation::of(w, q0, Some(f64::from(voters)), 9).ratio,
|
||||
quorums,
|
||||
};
|
||||
for cast in (0..=w.min(4000)).step_by(7).chain([w]) {
|
||||
let r = row(&scale, cast);
|
||||
assert!(r.windows(2).all(|p| p[0] <= p[1]), "W {w}, p̃ {voters}, T {cast}: {r:?}");
|
||||
let ratios: Vec<f64> =
|
||||
InertiaLevel::ALL.iter().map(|k| required_ratio(w, cast, &scale.params(*k))).collect();
|
||||
InertiaLevel::ALL.iter().map(|k| required_ratio(w, cast, &scale.params(*k, 0))).collect();
|
||||
if cast > 0 && cast < w {
|
||||
assert!(
|
||||
ratios.windows(2).all(|p| p[0] < p[1]),
|
||||
@@ -332,7 +380,7 @@ mod tests {
|
||||
for voters in [120, 360] {
|
||||
let scale = at_median(voters);
|
||||
for k in InertiaLevel::ALL {
|
||||
let p = scale.params(k);
|
||||
let p = scale.params(k, 0);
|
||||
let mut last = 1.0;
|
||||
for cast in (1..=W).step_by(13).chain([W]) {
|
||||
let ratio = required_ratio(W, cast, &p);
|
||||
@@ -346,26 +394,44 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn c_stays_a_floor_one_vote_never_passes_in_monnaie_libre() {
|
||||
fn under_the_quorum_one_vote_never_passes_in_monnaie_libre() {
|
||||
for voters in [1, 72, 120, 360, 3612] {
|
||||
let scale = Scale {
|
||||
electorate: W,
|
||||
floor: C,
|
||||
participation: Participation::of(W, C, Some(f64::from(voters)), 9).ratio,
|
||||
participation: Participation::of(W, Q0, Some(f64::from(voters)), 9).ratio,
|
||||
quorums: QUORUMS,
|
||||
};
|
||||
for k in InertiaLevel::ALL {
|
||||
let lone = scale.evaluate(Tally { for_votes: 1, against: 0 }, k).expect("valid");
|
||||
let q = scale.quorum(k, None);
|
||||
let lone = scale.evaluate(Tally { for_votes: 1, against: 0 }, k, q).expect("valid");
|
||||
assert!(!lone.reached, "k {}", k.get());
|
||||
assert_eq!(lone.required, 50);
|
||||
for cast in 1..=50 {
|
||||
assert!(scale.required(cast, k).expect("valid") >= 50, "nothing passes under C for");
|
||||
// Under the quorum, the voters missing count as against: the bar of Q voters.
|
||||
let at_q = scale.required(q, k, q).expect("valid");
|
||||
assert!(at_q >= 2, "one voice is never enough");
|
||||
for cast in 0..=q {
|
||||
assert_eq!(scale.required(cast, k, q).expect("valid"), at_q, "under the quorum, k {}", k.get());
|
||||
}
|
||||
assert!(!scale.evaluate(Tally { for_votes: 49, against: 0 }, k).expect("valid").reached);
|
||||
assert!(scale.evaluate(Tally { for_votes: 50, against: 0 }, k).expect("valid").reached);
|
||||
let short = Tally { for_votes: at_q - 1, against: 0 };
|
||||
assert!(!scale.evaluate(short, k, q).expect("valid").reached);
|
||||
let enough = scale.evaluate(Tally { for_votes: at_q, against: 0 }, k, q).expect("valid");
|
||||
assert!(enough.reached);
|
||||
assert_eq!(enough.yes_needed, at_q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_article_s_own_quorum_stands_for_its_level() {
|
||||
let scale = at_median(120);
|
||||
assert_eq!(scale.quorum(InertiaLevel::DEFAULT, None), 50);
|
||||
assert_eq!(scale.quorum(level(2), None), 12);
|
||||
assert_eq!(scale.quorum(InertiaLevel::DEFAULT, Some(20)), 20);
|
||||
// The curve stays the level's: only the quorum moves.
|
||||
let own = scale.params(InertiaLevel::DEFAULT, 20);
|
||||
let default = scale.params(InertiaLevel::DEFAULT, 50);
|
||||
assert_eq!((own.majority_pct, own.gradient, own.quorum), (default.majority_pct, default.gradient, 20));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_median() {
|
||||
assert_eq!(median(&[]), None);
|
||||
@@ -378,14 +444,14 @@ mod tests {
|
||||
#[test]
|
||||
fn the_reference_stands_in_until_five_proposals_are_voted_on() {
|
||||
// Monnaie libre: 2 × 50 / 7224 = 1.38 %, a hundred voters.
|
||||
assert!((Participation::reference_ratio(W, C) - 100.0 / 7224.0).abs() < 1e-15);
|
||||
let early = Participation::of(W, C, Some(120.0), 4);
|
||||
assert!((Participation::reference_ratio(W, Q0) - 100.0 / 7224.0).abs() < 1e-15);
|
||||
let early = Participation::of(W, Q0, Some(120.0), 4);
|
||||
assert_eq!(early.source, ParticipationSource::Reference);
|
||||
assert!((early.voters(W) - 100.0).abs() < 1e-9);
|
||||
assert_eq!((early.sample, early.median, early.bounded), (4, Some(120.0), false));
|
||||
let none = Participation::of(W, C, None, 0);
|
||||
let none = Participation::of(W, Q0, None, 0);
|
||||
assert_eq!(none.source, ParticipationSource::Reference);
|
||||
let measured = Participation::of(W, C, Some(120.0), 5);
|
||||
let measured = Participation::of(W, Q0, Some(120.0), 5);
|
||||
assert_eq!(measured.source, ParticipationSource::Median);
|
||||
assert!((measured.voters(W) - 120.0).abs() < 1e-9);
|
||||
assert!(!measured.bounded);
|
||||
@@ -394,7 +460,7 @@ mod tests {
|
||||
#[test]
|
||||
fn participation_is_kept_within_one_and_fifty_percent() {
|
||||
// Two voters on 7224: brought up to 1 %.
|
||||
let low = Participation::of(W, C, Some(2.0), 9);
|
||||
let low = Participation::of(W, Q0, Some(2.0), 9);
|
||||
assert_eq!((low.ratio, low.bounded), (0.01, true));
|
||||
// A group where everyone votes: brought down to half.
|
||||
let all = Participation::of(12, 1.0, Some(12.0), 9);
|
||||
@@ -418,12 +484,14 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_test_group_needs_everyone() {
|
||||
// W = 2, C = 1: both must vote for, at every level.
|
||||
let scale = Scale { electorate: 2, floor: 1.0, participation: Participation::of(2, 1.0, None, 0).ratio };
|
||||
fn the_test_group_at_a_quorum_of_one() {
|
||||
// W = 2, quorum 1 everywhere (Yvv, 2026-11-02): one « pour » alone passes, at every
|
||||
// level; one « pour » and one « contre » never (half of all, under any M of the levels).
|
||||
let scale = Scale { electorate: 2, participation: Participation::of(2, 1.0, None, 0).ratio, quorums: [1; 5] };
|
||||
for k in InertiaLevel::ALL {
|
||||
assert!(!scale.evaluate(Tally { for_votes: 1, against: 0 }, k).expect("valid").reached);
|
||||
assert!(scale.evaluate(Tally { for_votes: 2, against: 0 }, k).expect("valid").reached);
|
||||
assert!(scale.evaluate(Tally { for_votes: 1, against: 0 }, k, 1).expect("valid").reached);
|
||||
assert!(!scale.evaluate(Tally { for_votes: 1, against: 1 }, k, 1).expect("valid").reached);
|
||||
assert!(scale.evaluate(Tally { for_votes: 2, against: 0 }, k, 1).expect("valid").reached);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user