Struct unit::Unit

source ·
pub struct Unit { /* private fields */ }

Implementations§

source§

impl Unit

source

pub fn new(description: &str) -> Unit

Unit Constructor

source

pub fn check(self, tdd: bool) -> Unit

Run a test

source

pub fn ok(self, actual: bool) -> Unit

Check if actual match true

source

pub fn ko(self, actual: bool) -> Unit

Check if actual match false

source

pub fn equals(self, actual: i32, expected: i32) -> Unit

Check if two numbers are equals

source

pub fn unequals(self, actual: i32, expected: i32) -> Unit

Check if two numbers are unequals

source

pub fn identical(self, actual: &str, expected: &str) -> Unit

Check if two strings are equals

source

pub fn empty(self, actual: &str) -> Unit

Check if the actual value is empty

source

pub fn not_empty(self, actual: &str) -> Unit

Check if the actual value is not empty

source

pub fn different(self, actual: &str, expected: &str) -> Unit

Check if two strings are unequals

source

pub fn begin(self, actual: &String, expected: &str) -> Unit

Check if a string start with the expected value

source

pub fn finnish(self, actual: &String, expected: &str) -> Unit

Check if the string finnish wish the expected value

source

pub fn success(self, f: &dyn Fn() -> i32) -> Unit

Check if the callback f return 0

source

pub fn failure(self, f: &dyn Fn() -> i32) -> Unit

Check if the callback f return 1

source

pub fn theory( self, description: &str, f: &dyn Fn() -> bool, expected: bool ) -> Unit

Check a theory

source

pub fn describe(self, description: &str, f: &dyn Fn(Unit) -> Unit) -> Unit

Group a test case

source

pub fn defined(self, actual: String) -> Unit

Check is the string is defined (not empty)

source

pub fn exist(self, actual: &str) -> Unit

Check if the actual path exist

source

pub fn not_equal(self, actual: String, expected: &str) -> Unit

source

pub fn equal(self, actual: &String, expected: &str) -> Unit

Chef if actual is equal to expected

source

pub fn find(self, actual: &String, expected: &str) -> Unit

Check if expected is find in actual string

source

pub fn not_find(self, actual: String, expected: &str) -> Unit

Check if expected value is not find in the actual string

source

pub fn ascii(self, actual: String) -> Unit

Check if expected value is not find in the actual string

source

pub fn contains(self, actual: &String, expected: &str) -> Unit

Check if a string contains a string

source

pub fn superior(self, actual: usize, expected: usize) -> Unit

Check if the actual value is superior to the expected value

source

pub fn inferior(self, actual: usize, expected: usize) -> Unit

Check if the actual value is inferior to the expected value

source

pub fn between(self, actual: usize, min: usize, max: usize) -> Unit

Test if actual is between the min and the max value

source

pub fn end(self) -> i32

End of the tests

Auto Trait Implementations§

§

impl !RefUnwindSafe for Unit

§

impl Send for Unit

§

impl !Sync for Unit

§

impl Unpin for Unit

§

impl UnwindSafe for Unit

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.