mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
Use parameter_types instead of thread_local for test-setup (#12036)
* Edit to Assets. parameter_types * fixes * Test Fixes. WIP * Edits to pallet-aura * Camel Case Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Implementation of mutate fn * update to pallet-aura * Update to frame-system. Fixes * Update to frame-support-test. CamelCases * Updates to frame- contracts, offences, staking, bounties, child bounties * Edit to mutate fn. Changes to frame-contracts. CamelCase pallet-aura * Edits to frame-contracts & executive * cargo +nightly fmt * unused import removed * unused import removed * cargo +nightly fmt * minor adjustment * updates * updates * cargo +nightly fmt * cargo +nightly fmt * take fn implemented * update * update * Fixes to CallFilter * cargo +nightly fmt * final fixes * Default changed to $value * Update frame/support/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -19,8 +19,6 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
@@ -100,18 +98,17 @@ impl pallet_balances::Config for Test {
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
thread_local! {
|
||||
static TEN_TO_FOURTEEN: RefCell<Vec<u128>> = RefCell::new(vec![10,11,12,13,14]);
|
||||
parameter_types! {
|
||||
static TenToFourteenTestValue: Vec<u128> = vec![10,11,12,13,14];
|
||||
}
|
||||
pub struct TenToFourteen;
|
||||
impl SortedMembers<u128> for TenToFourteen {
|
||||
fn sorted_members() -> Vec<u128> {
|
||||
TEN_TO_FOURTEEN.with(|v| v.borrow().clone())
|
||||
TenToFourteenTestValue::get().clone()
|
||||
}
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn add(new: &u128) {
|
||||
TEN_TO_FOURTEEN.with(|v| {
|
||||
let mut members = v.borrow_mut();
|
||||
TenToFourteenTestValue::mutate(|members| {
|
||||
members.push(*new);
|
||||
members.sort();
|
||||
})
|
||||
@@ -119,7 +116,7 @@ impl SortedMembers<u128> for TenToFourteen {
|
||||
}
|
||||
impl ContainsLengthBound for TenToFourteen {
|
||||
fn max_len() -> usize {
|
||||
TEN_TO_FOURTEEN.with(|v| v.borrow().len())
|
||||
TenToFourteenTestValue::get().len()
|
||||
}
|
||||
fn min_len() -> usize {
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user