mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 08:41:07 +00:00
Generate Unit Tests for Benchmarks (#5527)
* Update to latest staking * generate tests for benchmarking * add tests, fix warnings * starting on democracy * impl_benchmark_tests * Way more readable * add test feature flag (does this work?) * Fix `successful_origin` impl * democracry benchmark tests * Fix example benchmarks, add tests * identity benchmark tests * Update im-online benchmark tests * try to add session benchmarking tests (problem with mock) * staking and timestamp * add test for treasury, issue with dynamic contains * utility * Vesting * test instead of check * hide until we figure out what is wrong * add docs * close code * Create custom mock for session-pallet-benchmarking * Use refcell pattern * make un-pub * test-linux-stable includes `runtime-benchmarks` feature * Revert "test-linux-stable includes `runtime-benchmarks` feature" This reverts commit a2dab38abd18ac3eb8a6220e4a00e687740bd38c. * run tests in `--release` * undo balance change * build wasm
This commit is contained in:
@@ -119,3 +119,45 @@ benchmarks! {
|
||||
let _ = <Balances<T> as Currency<_>>::make_free_balance_be(&user, balance_amount);
|
||||
}: set_balance(RawOrigin::Root, user_lookup, 0.into(), 0.into())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::tests_composite::{ExtBuilder, Test};
|
||||
use frame_support::assert_ok;
|
||||
|
||||
#[test]
|
||||
fn transfer() {
|
||||
ExtBuilder::default().build().execute_with(|| {
|
||||
assert_ok!(test_benchmark_transfer::<Test>());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transfer_best_case() {
|
||||
ExtBuilder::default().build().execute_with(|| {
|
||||
assert_ok!(test_benchmark_transfer_best_case::<Test>());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transfer_keep_alive() {
|
||||
ExtBuilder::default().build().execute_with(|| {
|
||||
assert_ok!(test_benchmark_transfer_keep_alive::<Test>());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transfer_set_balance() {
|
||||
ExtBuilder::default().build().execute_with(|| {
|
||||
assert_ok!(test_benchmark_set_balance::<Test>());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transfer_set_balance_killing() {
|
||||
ExtBuilder::default().build().execute_with(|| {
|
||||
assert_ok!(test_benchmark_set_balance_killing::<Test>());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user