pub enum SortMatcher {
Ascending,
Descending,
}Expand description
SortMatcher offers a flexible way to assert whether a collection is sorted in ascending or descending order.
clearcheck implements SortMatcher for collection types including vector, arrays and reference to slices.
§Example
use clearcheck::matchers::collection::sort::{be_sorted_ascending, SortMatcher};
use clearcheck::matchers::Matcher;
let matcher = be_sorted_ascending();
let collection = vec!["clearcheck", "junit"];
assert!(matcher.test(&collection).passed());Variants§
Trait Implementations§
Source§impl<T: PartialOrd + Debug> Matcher<&[T]> for SortMatcher
impl<T: PartialOrd + Debug> Matcher<&[T]> for SortMatcher
fn test(&self, collection: &&[T]) -> MatcherResult
Source§impl<T: PartialOrd + Debug> Matcher<Vec<T>> for SortMatcher
impl<T: PartialOrd + Debug> Matcher<Vec<T>> for SortMatcher
fn test(&self, collection: &Vec<T>) -> MatcherResult
Source§impl<T: PartialOrd + Debug, const N: usize> Matcher<[T; N]> for SortMatcher
impl<T: PartialOrd + Debug, const N: usize> Matcher<[T; N]> for SortMatcher
fn test(&self, collection: &[T; N]) -> MatcherResult
Auto Trait Implementations§
impl Freeze for SortMatcher
impl RefUnwindSafe for SortMatcher
impl Send for SortMatcher
impl Sync for SortMatcher
impl Unpin for SortMatcher
impl UnsafeUnpin for SortMatcher
impl UnwindSafe for SortMatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ShouldNot<T> for T
impl<T> ShouldNot<T> for T
Source§fn should_not(&self, matcher: &dyn Matcher<T>)
fn should_not(&self, matcher: &dyn Matcher<T>)
Takes a matcher as input and performs an inverted assertion against the value itself.Inverts the result of the matcher’s test method, ensuring the value does not match.Panics if the inverted assertion fails, indicating that the value unexpectedly matched the matcher. Read more