Extend the lower bounds of some of the benchmarks to also include 0 (#12386)

* Extend the lower bounds of some of the benchmarks to also include `0`

* Fix verify snippet for `pallet_bounties/spend_funds`
This commit is contained in:
Koute
2022-10-07 23:16:41 +09:00
committed by GitHub
parent fc3f9268f6
commit eee79a1fa4
11 changed files with 109 additions and 90 deletions
+7 -3
View File
@@ -197,7 +197,7 @@ benchmarks_instance_pallet! {
}
spend_funds {
let b in 1 .. 100;
let b in 0 .. 100;
setup_pot_account::<T, I>();
create_approved_bounties::<T, I>(b)?;
@@ -214,9 +214,13 @@ benchmarks_instance_pallet! {
);
}
verify {
ensure!(budget_remaining < BalanceOf::<T, I>::max_value(), "Budget not used");
ensure!(missed_any == false, "Missed some");
assert_last_event::<T, I>(Event::BountyBecameActive { index: b - 1 }.into())
if b > 0 {
ensure!(budget_remaining < BalanceOf::<T, I>::max_value(), "Budget not used");
assert_last_event::<T, I>(Event::BountyBecameActive { index: b - 1 }.into())
} else {
ensure!(budget_remaining == BalanceOf::<T, I>::max_value(), "Budget used");
}
}
impl_benchmark_test_suite!(Bounties, crate::tests::new_test_ext(), crate::tests::Test)