Skip to content

Commit

Permalink
consensus: add majority tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fed-franz committed Aug 20, 2024
1 parent 3c5aeba commit 09e4846
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ pub fn ratification_extra() -> usize {
#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_majorities() {
assert_eq!(majority(4), 3);
assert_eq!(majority(11), 6);
assert_eq!(majority(99), 50);
assert_eq!(supermajority(3), 2);
assert_eq!(supermajority(9), 6);
assert_eq!(supermajority(51), 34);
}

#[test]
fn test_quorums() {
assert_eq!(majority(VALIDATION_COMMITTEE_CREDITS), 33);
Expand Down

0 comments on commit 09e4846

Please sign in to comment.