Assertion

Class returned by should, that it's used to generate the fluent API

struct Assertion (
T
) {}

Constructors

this
this(T _context)

Creates a instance of Assertion, wrapping a value or object

Members

Aliases

a
alias a = id
and
alias and = id
as
alias as = id

Identity function. Simply does nothing beyond making assertation more human friendly

be
alias be = id

Identity function. Simply does nothing beyond making assertation more human friendly

close
alias close = approxEqual

Alias to approxEqual

contain
alias contain = include

Asserts for an input range wrapped around an Assertion to contain/include a value.

have
alias have = id
of
alias of = id
to
alias to = id

Identity function. Simply does nothing beyond making assertation more human friendly

value
alias value = include

Asserts for an input range wrapped around an Assertion to contain/include a value.

which
alias which = id

Identity function. Simply does nothing beyond making assertation more human friendly

Functions

False
bool False(string file, size_t line)

Asserts for a boolean value to be equal to true.

Throw
void Throw(string file, size_t line)

Asserts whether a callable object wrapped around the assertion throws an exception of type T.

True
bool True(string file, size_t line)

Asserts for a boolean value to be equal to true.

approxEqual
T approxEqual(U other, U maxRelDiff, U maxAbsDiff, string file, size_t line)

Asserts that a float type is aproximated equal. Returns the valued wrapped around the assertion

biggerOrEqualThan
bool biggerOrEqualThan(U other, string file, size_t line)

Asserts if a value is bigger or equal than another value. Returns the result.

biggerThan
bool biggerThan(U other, string file, size_t line)

Asserts if a value is bigger than another value. Returns the result.

empty
bool empty(string file, size_t line)

Asserts for the .length property or function value to be equal to 0.

equal
T equal(U other, string file, size_t line)

Asserts for equality between two objects. Returns the value wrapped around the assertion.

exist
T exist(string file, size_t line)

Asserts whether a value exists - currently simply compares it with null, if it is a pointer, a class or a string. Returns the value wrapped around the assertion.

id
Assertion id()

Identity function. Simply does nothing beyond making assertation more human friendly

include
U include(U other, string file, size_t line)

Asserts for an input range wrapped around an Assertion to contain/include a value.

include
U include(U other, string file, size_t line)

Asserts for an input range wrapped around an Assertion to contain/include a value.

key
void key(U other, string file, size_t line)

Asserts for an associative array to have a key equal to other.

length
U length(U len, string file, size_t line)

Asserts for the .length property or function value to equal some value.

match
auto match(RegEx re, string file, size_t line)
auto match(U re, string file, size_t line)

Asserts for a string wrapped around the Assertion to match a regular expression.

not
Assertion not()

This function negates the wrapper assertion. With it, one can express fluent assertions without much effort.

smallerOrEqualThan
bool smallerOrEqualThan(U other, string file, size_t line)

Asserts if a value is smaller or euqal than another value. Returns the result.

smallerThan
bool smallerThan(U other, string file, size_t line)

Asserts if a value is smaller than another value. Returns the result.

sorted
bool sorted(string file, size_t line)

Asserts whether a forward range is sorted.

Meta