mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Add verify block to benchmark tests (#5551)
* Add verify block to benchmarks macro. * Update all benchmarks. * Add tests, add params. * Should panic. * ups, add closures * Update tests.rs * update macro syntax * Revert benchmark syntax change * verify only in tests * Update tests.rs * Uncomment staking * Fix tests for benchmark instance * Add docs * Update frame/benchmarking/src/lib.rs * add trace logs to benchmarks * Verify returns closure Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -589,7 +589,7 @@ mod tests {
|
||||
}
|
||||
);
|
||||
|
||||
fn make_ext() -> sp_io::TestExternalities {
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
||||
collective_Instance1: Some(collective::GenesisConfig {
|
||||
members: vec![1, 2, 3],
|
||||
@@ -603,7 +603,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_basic_environment_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_eq!(Collective::members(), vec![1, 2, 3]);
|
||||
assert_eq!(Collective::proposals(), Vec::<H256>::new());
|
||||
});
|
||||
@@ -615,7 +615,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn close_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash = BlakeTwo256::hash_of(&proposal);
|
||||
|
||||
@@ -643,7 +643,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn close_with_prime_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash = BlakeTwo256::hash_of(&proposal);
|
||||
assert_ok!(Collective::set_members(Origin::ROOT, vec![1, 2, 3], Some(3)));
|
||||
@@ -666,7 +666,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn close_with_voting_prime_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash = BlakeTwo256::hash_of(&proposal);
|
||||
assert_ok!(Collective::set_members(Origin::ROOT, vec![1, 2, 3], Some(1)));
|
||||
@@ -690,7 +690,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn removal_of_old_voters_votes_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash = BlakeTwo256::hash_of(&proposal);
|
||||
let end = 4;
|
||||
@@ -724,7 +724,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn removal_of_old_voters_votes_works_with_set_members() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash = BlakeTwo256::hash_of(&proposal);
|
||||
let end = 4;
|
||||
@@ -758,7 +758,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn propose_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash = proposal.blake2_256().into();
|
||||
let end = 4;
|
||||
@@ -787,7 +787,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_ignoring_non_collective_proposals_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
assert_noop!(
|
||||
Collective::propose(Origin::signed(42), 3, Box::new(proposal.clone())),
|
||||
@@ -798,7 +798,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_ignoring_non_collective_votes_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash: H256 = proposal.blake2_256().into();
|
||||
assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone())));
|
||||
@@ -811,7 +811,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_ignoring_bad_index_collective_vote_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(3);
|
||||
let proposal = make_proposal(42);
|
||||
let hash: H256 = proposal.blake2_256().into();
|
||||
@@ -825,7 +825,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_revoting_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash: H256 = proposal.blake2_256().into();
|
||||
let end = 4;
|
||||
@@ -876,7 +876,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_reproposing_disapproved_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash: H256 = proposal.blake2_256().into();
|
||||
assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone())));
|
||||
@@ -889,7 +889,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_disapproval_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash: H256 = proposal.blake2_256().into();
|
||||
assert_ok!(Collective::propose(Origin::signed(1), 3, Box::new(proposal.clone())));
|
||||
@@ -931,7 +931,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn motions_approval_works() {
|
||||
make_ext().execute_with(|| {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = make_proposal(42);
|
||||
let hash: H256 = proposal.blake2_256().into();
|
||||
assert_ok!(Collective::propose(Origin::signed(1), 2, Box::new(proposal.clone())));
|
||||
|
||||
Reference in New Issue
Block a user