123use crate::{Module, Trait};4use frame_support::{5 impl_outer_origin, parameter_types,6 weights::{7 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},8 Weight,9 },10};11use frame_system as system;12use sp_core::H256;13use sp_runtime::{14 testing::Header,15 traits::{BlakeTwo256, IdentityLookup, Saturating},16 Perbill,17};1819impl_outer_origin! {20 pub enum Origin for Test {}21}2223242526#[derive(Clone, Eq, PartialEq)]27pub struct Test;28parameter_types! {29 pub const BlockHashCount: u64 = 250;30 pub const MaximumBlockWeight: Weight = 1024;31 pub const MaximumBlockLength: u32 = 2 * 1024;32 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);33 pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get()34 .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get();35}3637impl system::Trait for Test {38 type BaseCallFilter = ();39 type Origin = Origin;40 type Call = ();41 type Index = u64;42 type BlockNumber = u64;43 type Hash = H256;44 type Hashing = BlakeTwo256;45 type AccountId = u64;46 type Lookup = IdentityLookup<Self::AccountId>;47 type Header = Header;48 type Event = ();49 type BlockHashCount = BlockHashCount;50 type MaximumBlockWeight = MaximumBlockWeight;51 type DbWeight = ();52 type BlockExecutionWeight = ();53 type ExtrinsicBaseWeight = ();54 type MaximumExtrinsicWeight = MaximumBlockWeight;55 type MaximumBlockLength = MaximumBlockLength;56 type AvailableBlockRatio = AvailableBlockRatio;57 type Version = ();58 type PalletInfo = ();59 type AccountData = ();60 type OnNewAccount = ();61 type OnKilledAccount = ();62 type SystemWeightInfo = ();63}64impl Trait for Test {65 type Event = ();66}67pub type TemplateModule = Module<Test>;6869707172pub fn new_test_ext() -> sp_io::TestExternalities {73 system::GenesisConfig::default()74 .build_storage::<Test>()75 .unwrap()76 .into()77}