From b1abe914fca06f1294a60fc519bcc7c75a60abe5 Mon Sep 17 00:00:00 2001 From: Lldenaurois Date: Thu, 23 Sep 2021 15:46:26 +0200 Subject: [PATCH] Update tests --- .../approval-voting/src/approval_checking.rs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/node/core/approval-voting/src/approval_checking.rs b/node/core/approval-voting/src/approval_checking.rs index 2e7cbf1bd6a8..1d96dc495af1 100644 --- a/node/core/approval-voting/src/approval_checking.rs +++ b/node/core/approval-voting/src/approval_checking.rs @@ -316,10 +316,9 @@ fn count_no_shows( let mut next_no_show = None; let no_shows = assignments .iter() - .map(|(v_index, tick)| ( - v_index, - tick.min(&block_tick).saturating_sub(clock_drift) + no_show_duration, - )) + .map(|(v_index, tick)| { + (v_index, tick.min(&block_tick).saturating_sub(clock_drift) + no_show_duration) + }) .filter(|&(v_index, no_show_at)| { let has_approved = if let Some(approved) = approvals.get(v_index.0 as usize) { *approved @@ -829,7 +828,7 @@ mod tests { RequiredTranches::Exact { needed: 1, tolerated_missing: 0, - next_no_show: Some(block_tick + no_show_duration + 1), + next_no_show: Some(block_tick + no_show_duration), }, ); @@ -844,10 +843,11 @@ mod tests { no_show_duration, needed_approvals, ), - RequiredTranches::Exact { - needed: 2, - tolerated_missing: 1, - next_no_show: Some(block_tick + 2 * no_show_duration + 2), + RequiredTranches::Pending { + considered: 2, + next_no_show: None, + maximum_broadcast: 3, + clock_drift: block_tick, }, ); @@ -1079,7 +1079,7 @@ mod tests { &test.assignments, &approvals, test.clock_drift, - 0, // TODO: Ladi, add to tests. + 20, // TODO: Ladi, add to tests. test.no_show_duration, test.drifted_tick_now, ); @@ -1108,8 +1108,8 @@ mod tests { clock_drift: 10, no_show_duration: 10, drifted_tick_now: 20, - exp_no_shows: 0, - exp_next_no_show: Some(31), + exp_no_shows: 1, + exp_next_no_show: None, }) } @@ -1147,8 +1147,8 @@ mod tests { clock_drift: 10, no_show_duration: 10, drifted_tick_now: 20, - exp_no_shows: 0, - exp_next_no_show: Some(31), + exp_no_shows: 2, + exp_next_no_show: None, }) } @@ -1160,8 +1160,8 @@ mod tests { clock_drift: 10, no_show_duration: 10, drifted_tick_now: 20, - exp_no_shows: 0, - exp_next_no_show: Some(31), + exp_no_shows: 2, + exp_next_no_show: None, }) } @@ -1177,8 +1177,8 @@ mod tests { clock_drift: 10, no_show_duration: 10, drifted_tick_now: 20, - exp_no_shows: 1, - exp_next_no_show: Some(31), + exp_no_shows: 2, + exp_next_no_show: None, }) }