Skip to content

Commit

Permalink
Update as suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed Nov 19, 2024
1 parent ed5d802 commit 250cdc2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions substrate/frame/scheduler/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ mod benchmarks {
#[extrinsic_call]
_(RawOrigin::Root, when, periodic, priority, call);

assert_eq!(Agenda::<T>::get(when).len(), s as usize + 1, "didn't add to schedule");
ensure!(Agenda::<T>::get(when).len() == s as usize + 1, "didn't add to schedule");

Ok(())
}
Expand All @@ -314,16 +314,16 @@ mod benchmarks {
#[extrinsic_call]
_(schedule_origin as SystemOrigin<T>, when, 0);

assert!(
ensure!(
s == 1 || Lookup::<T>::get(u32_to_name(0)).is_none(),
"didn't remove from lookup if more than 1 task scheduled for `when`"
);
// Removed schedule is NONE
assert!(
ensure!(
s == 1 || Agenda::<T>::get(when)[0].is_none(),
"didn't remove from schedule if more than 1 task scheduled for `when`"
);
assert!(
ensure!(
s > 1 || Agenda::<T>::get(when).len() == 0,
"remove from schedule if only 1 task scheduled for `when`"
);
Expand All @@ -347,7 +347,7 @@ mod benchmarks {
#[extrinsic_call]
_(RawOrigin::Root, id, when, periodic, priority, call);

assert_eq!(Agenda::<T>::get(when).len(), s as usize + 1, "didn't add to schedule");
ensure!(Agenda::<T>::get(when).len() == s as usize + 1, "didn't add to schedule");

Ok(())
}
Expand All @@ -358,21 +358,21 @@ mod benchmarks {
) -> Result<(), BenchmarkError> {
let when = BLOCK_NUMBER.into();

fill_schedule::<T>(when, s).unwrap();
fill_schedule::<T>(when, s)?;

#[extrinsic_call]
_(RawOrigin::Root, u32_to_name(0));

assert!(
ensure!(
s == 1 || Lookup::<T>::get(u32_to_name(0)).is_none(),
"didn't remove from lookup if more than 1 task scheduled for `when`"
);
// Removed schedule is NONE
assert!(
ensure!(
s == 1 || Agenda::<T>::get(when)[0].is_none(),
"didn't remove from schedule if more than 1 task scheduled for `when`"
);
assert!(
ensure!(
s > 1 || Agenda::<T>::get(when).len() == 0,
"remove from schedule if only 1 task scheduled for `when`"
);
Expand Down

0 comments on commit 250cdc2

Please sign in to comment.