forked from yvv/decision
Lot U2 : settings.reading dit « au-delà du quorum » comme N1.1 et formula.reading (fr, en, es) ; l'anglais en un seul vocabulaire (for et against, jamais yes et no ; favour partout) ; le commentaire de threshold.rs écrit juste (la part la plus haute au quorum, puis qui baisse jusqu'à M), et un test qui le tient
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,9 +6,12 @@
|
||||
//! ```
|
||||
//!
|
||||
//! R is the minimum number of *for* votes; a version passes when `for ≥ ⌈R⌉`.
|
||||
//! W is the size of the electorate, T the votes cast (for + against). At low
|
||||
//! participation the formula asks for near-unanimity, at full participation the
|
||||
//! simple majority M suffices. Q is the **quorum** (ADR 0013, Yvv, 2026-11-02:
|
||||
//! W is the size of the electorate, T the votes cast (for + against). The share of
|
||||
//! *for* asked is judged on T' voters, never fewer than the quorum: it is at its
|
||||
//! highest at the quorum (the share of the level at T' = Q), then falls as turnout
|
||||
//! rises above it, down to the simple majority M when the whole electorate votes.
|
||||
//! Below the quorum it does not rise any further: the voters missing count as
|
||||
//! against. Q is the **quorum** (ADR 0013, Yvv, 2026-11-02:
|
||||
//! « ce n'est pas un nombre de vote pour a priori, c'est plutôt un quorum, à partir
|
||||
//! de ce nombre, alors il faut la bonne proportion attendue par l'indice ») — and
|
||||
//! below it the voters missing count as against (`judged_voters`). It replaces the
|
||||
@@ -234,6 +237,28 @@ mod tests {
|
||||
assert_eq!(e.missing, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_share_is_highest_at_the_quorum_then_falls_to_the_majority() {
|
||||
// What the head of this module says (lot U2, review of M6c): judged on T' voters, the
|
||||
// share of *for* is at its highest at the quorum, falls as turnout rises, and is M when
|
||||
// the whole electorate votes; below the quorum it stays that of the quorum.
|
||||
let (w, q) = (5745, 12);
|
||||
let p = standard(q);
|
||||
let share = |cast: u32| required_ratio(w, judged_voters(cast, q), &p);
|
||||
for cast in 0..q {
|
||||
assert!((share(cast) - share(q)).abs() < 1e-12, "below the quorum, at {cast}");
|
||||
}
|
||||
let mut last = share(q);
|
||||
for cast in (q + 1..w).step_by(7).chain([w]) {
|
||||
let now = share(cast);
|
||||
assert!(now < last, "falls at {cast}: {now} after {last}");
|
||||
last = now;
|
||||
}
|
||||
assert!((share(w) - 0.5).abs() < 1e-12, "M at full turnout");
|
||||
// Never « near-unanimity »: at this level, 85 % of the quorum.
|
||||
assert!(share(q) > 0.8 && share(q) < 0.9, "at the quorum: {}", share(q));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parity_with_the_typescript_reference() {
|
||||
// Values computed by maquette/frontend/app/engine/threshold.ts (C = 0).
|
||||
|
||||
Reference in New Issue
Block a user