Struct unit::tdd::unit::Unit

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

Implementations§

source§

impl Unit

source

pub fn describe( &mut self, description: &str, it: fn(_: &mut Unit) -> &mut Unit ) -> &mut Unit

Group test in a function
  • description The group test description
  • it The callback to execute
source

pub fn new(description: &str, time: u64, s: Style) -> Unit

Unit constructor
  • description The unit test description
  • time The sleep time
source

pub fn end(&mut self) -> Result<String, String>

End of the tests

source

pub fn ok(&mut self, b: bool) -> &mut Unit

source

pub fn ko(&mut self, b: bool) -> &mut Unit

source

pub fn equals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Unit

Check if two value are equals
  • a The first value
  • b The second value
source

pub fn between<T: PartialOrd>(&mut self, actual: T, min: T, max: T) -> &mut Unit

Check if actual is in min and []ax value
  • actual The actual value
  • min The minimun value for actual
  • max The maximum value for actual
source

pub fn unequals<T: PartialEq>(&mut self, a: T, b: T) -> &mut Unit

Check if values are unequals

  • a The first value
  • b The second value
source

pub fn inferior<T: PartialOrd>(&mut self, actual: T, max: T) -> &mut Unit

Check if the value is inferior to the maximum value
  • actual The actual value
  • max The maximum value
source

pub fn superior<T: PartialOrd>(&mut self, actual: T, min: T) -> &mut Unit

Check if the value is superior to the minimun value
  • actual The actual value
  • min The minimum value
source

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

Check if a string is not empty
  • x The string to check
source

pub fn contains(&mut self, x: &str, expected: &str) -> &mut Unit

Check if a string contains another string
  • x The string to check
  • expected The string to verify
source

pub fn not_contains(&mut self, x: &str, expected: &str) -> &mut Unit

Check if a string not contains another string
  • x The string to check
  • expected The string to verify
source

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

Check if a string is empty
  • x The string to check
source

pub fn is_directory(&mut self, d: &str) -> &mut Unit

source

pub fn is_not_directory(&mut self, d: &str) -> &mut Unit

source

pub fn is_file(&mut self, f: &str) -> &mut Unit

source

pub fn path_start_with(&mut self, path: &str, base: &str) -> &mut Unit

Chek if a path start with a expected base
  • path The path to check
  • base The path’s base
source

pub fn path_absolute(&mut self, path: &str) -> &mut Unit

Chek if a path is absolute
  • path The path to check
source

pub fn path_not_absolute(&mut self, path: &str) -> &mut Unit

Chek if a path is not absolute
  • path The path to check
source

pub fn path_exists(&mut self, path: &str) -> &mut Unit

Chek if a path exist
  • path The path to check
source

pub fn path_not_relative(&mut self, path: &str) -> &mut Unit

Chek if a path is not relative
  • path The path to check
source

pub fn is_executable(&mut self, path: &str) -> &mut Unit

Chek if a path is not relative
  • path The path to check
source

pub fn is_not_executable(&mut self, path: &str) -> &mut Unit

Chek if a path is relative
  • path The path to check
Chek if a path is relative
  • path The path to check
source

pub fn path_relative(&mut self, path: &str) -> &mut Unit

Chek if a path exist
  • path The path to check
source

pub fn path_no_exists(&mut self, path: &str) -> &mut Unit

Chek if a path is not absolute
  • path The path to check
source

pub fn file_contains(&mut self, file: &str, expected: &str) -> &mut Unit

Check if a file contains an another string
  • file The path to check
  • expected The expected value
source

pub fn file_no_contains(&mut self, file: &str, expected: &str) -> &mut Unit

Check if a file no contains an another string
  • file The path to check
  • expected The unexpected value
source

pub fn theory<T: PartialEq>(&mut self, t: T, expected: T) -> &mut Unit

Check if the theory is true
  • t The theory result
  • expected The theory expected result
source

pub fn chaos<T: PartialEq>(&mut self, t: T, unexpected: T) -> &mut Unit

source

pub fn vec_length_equals<T: PartialEq>( &mut self, a: Vec<T>, b: Vec<T> ) -> &mut Unit

Check if two vec length are equals
  • a The first vector
  • b The second vector
source

pub fn vec_length_unequals<T: PartialEq>( &mut self, a: Vec<T>, b: Vec<T> ) -> &mut Unit

Check if two vec length are unequals
  • a The first vector
  • b The second vector
source

pub fn vec_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Unit

Check if a vec contains a value
  • a The vector
  • b The value
source

pub fn vec_no_contains<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Unit

Check if a vec not contains a value
  • a The vector
  • b The value
source

pub fn vec_start_with<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Unit

Check if a vec start with a value
  • a The vector
  • b The value
source

pub fn vec_no_start_with<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Unit

Check if a vec no start with a value
  • a The vector
  • b The value
source

pub fn vec_end_with<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Unit

Check if a vec finnish with a value
  • a The vector
  • b The value
source

pub fn vec_no_end_with<T: PartialEq>(&mut self, a: Vec<T>, b: T) -> &mut Unit

Check if a vec finnish with a value
  • a The vector
  • b The value
source

pub fn vec_empty<T: PartialEq>(&mut self, a: Vec<T>) -> &mut Unit

source

pub fn vec_not_empty<T: PartialEq>(&mut self, a: Vec<T>) -> &mut Unit

source

pub fn full(&mut self, callback: fn() -> usize, max: usize) -> &mut Unit

Check if the return of the callback is not at this maximum value
  • callback The callback to check
  • max The callback maximum value
source

pub fn not_full(&mut self, callback: fn() -> usize, max: usize) -> &mut Unit

Check if the return of the callback is not at this maximum value
  • callback The callback to check
  • max The callback maximum value
source

pub fn prime(&mut self, x: usize) -> &mut Unit

source

pub fn pair(&mut self, x: usize) -> &mut Unit

source

pub fn impair(&mut self, x: usize) -> &mut Unit

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.