Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lldenaurois committed Sep 23, 2021
1 parent 5f7ee6b commit b1abe91
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions node/core/approval-voting/src/approval_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
},
);

Expand All @@ -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,
},
);

Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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,
})
}

Expand All @@ -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,
})
}

Expand All @@ -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,
})
}

Expand Down

0 comments on commit b1abe91

Please sign in to comment.