Add test for k-invites

This commit is contained in:
onyinyang 2023-08-02 17:20:08 -04:00
parent faf40caf3a
commit 7647564c1e
No known key found for this signature in database
GPG Key ID: 156A6435430C2036
1 changed files with 15 additions and 0 deletions

View File

@ -394,6 +394,21 @@ fn test_open_invite() {
assert!(bridgeline == bucket.0[0]);
}
#[test]
fn test_k_invites() {
let mut th = TestHarness::new();
for i in 0..25 {
let _ = th.open_invite();
if (i+1) % OPENINV_K != 0 {
assert!(th.bdb.current_k == (i+1)%OPENINV_K, "the current_k should be (i+1)%OPENINV_K");
} else {
assert!(th.bdb.current_k == OPENINV_K, "the current_k should be OPENINV_K");
}
}
}
#[test]
fn test_trust_promotion() {
let mut th = TestHarness::new();