abstract_testing::map_tester

Struct CwMapTester

Source
pub struct CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where K: KeyDeserialize + Debug, K::Output: 'static,
{ /* private fields */ }

Implementations§

Source§

impl<'a, ExecMsg, TError, K, V, UncheckedK, UncheckedV> CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where V: Serialize + DeserializeOwned + Clone + Debug, K: PrimaryKey<'a> + KeyDeserialize + Debug, (&'a <K as KeyDeserialize>::Output, V): PartialEq<(K, V)>, K::Output: 'static, UncheckedK: Clone + PartialEq + Debug + Serialize, UncheckedV: Clone + PartialEq + Debug, <K as KeyDeserialize>::Output: Debug,

Source

pub fn new( info: MessageInfo, map: Map<K, V>, execute: fn(deps: DepsMut<'_>, env: Env, info: MessageInfo, msg: ExecMsg) -> Result<Response, TError>, msg_builder: fn(to_add: Vec<(UncheckedK, UncheckedV)>, to_remove: Vec<UncheckedK>) -> ExecMsg, mock_entry: (UncheckedK, UncheckedV), from_checked_entry: fn(_: (K::Output, V)) -> (UncheckedK, UncheckedV), ) -> Self

Source

pub fn msg_builder( &self, to_add: Vec<(UncheckedK, UncheckedV)>, to_remove: Vec<UncheckedK>, ) -> ExecMsg

Source

pub fn execute(&mut self, deps: DepsMut<'_>, msg: ExecMsg) -> Result<(), TError>

Execute the msg with the mock env

Source

pub fn execute_update( &mut self, deps: DepsMut<'_>, (to_add, to_remove): (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>), ) -> Result<(), TError>

Source

pub fn assert_expected_entries( &self, storage: &dyn Storage, expected: Vec<(UncheckedK, UncheckedV)>, )

Source

pub fn test_add_one(&mut self, deps: &mut MockDeps) -> Result<(), TError>

Source

pub fn test_add_one_twice(&mut self, deps: &mut MockDeps) -> Result<(), TError>

Source

pub fn test_add_two_same(&mut self, deps: &mut MockDeps) -> Result<(), TError>

Source

pub fn test_add_and_remove_same( &mut self, deps: &mut MockDeps, ) -> Result<(), TError>

Source

pub fn test_remove_nonexistent( &mut self, deps: &mut MockDeps, ) -> Result<(), TError>

Source

pub fn test_all(&mut self, deps: &mut MockDeps) -> Result<(), TError>

Run through all the preconfigured test scenarios

Source

pub fn test_update_auto_expect( &mut self, deps: &mut MockDeps, update: (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>), ) -> Result<(), TError>

Test the manually provided arguments with the expected behavior, which is removing any duplicate entries that are within both add and remove

Source

pub fn test_update_with_expected( &mut self, deps: &mut MockDeps, update: (Vec<(UncheckedK, UncheckedV)>, Vec<UncheckedK>), expected: Vec<(UncheckedK, UncheckedV)>, ) -> Result<(), TError>

Provide an update nad expected result, and test that the expected result is returned

Auto Trait Implementations§

§

impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Freeze for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where UncheckedK: Freeze, UncheckedV: Freeze,

§

impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> RefUnwindSafe for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where UncheckedK: RefUnwindSafe, UncheckedV: RefUnwindSafe, K: RefUnwindSafe, V: RefUnwindSafe,

§

impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Send for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where UncheckedK: Send, UncheckedV: Send, K: Send, V: Send,

§

impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Sync for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where UncheckedK: Sync, UncheckedV: Sync, K: Sync, V: Sync,

§

impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> Unpin for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where UncheckedK: Unpin, UncheckedV: Unpin, K: Unpin, V: Unpin,

§

impl<ExecMsg, TError, K, V, UncheckedK, UncheckedV> UnwindSafe for CwMapTester<ExecMsg, TError, K, V, UncheckedK, UncheckedV>
where UncheckedK: UnwindSafe, UncheckedV: UnwindSafe, K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V