unit_threaded.assertions

This module implements custom assertions via shouldXXX functions that throw exceptions containing information about why the assertion failed.

Members

Enums

isLikeAssociativeArray
eponymoustemplate isLikeAssociativeArray(T, K)
Undocumented in source.

Functions

be
T be(T sh)
Undocumented in source. Be warned that the author may not have intended to support it.
convertToString
string convertToString(T value)
Undocumented in source. Be warned that the author may not have intended to support it.
isApproxEqual
bool isApproxEqual(V value, E expected, double maxRelDiff, double maxAbsDiff)
Undocumented in source. Be warned that the author may not have intended to support it.
isEqual
bool isEqual(V value, E expected)
Undocumented in source. Be warned that the author may not have intended to support it.
isEqual
bool isEqual(V value, E expected)
Undocumented in source. Be warned that the author may not have intended to support it.
isEqual
bool isEqual(V value, E expected)
Undocumented in source. Be warned that the author may not have intended to support it.
isEqual
bool isEqual(V value, E expected)
Undocumented in source. Be warned that the author may not have intended to support it.
isEqual
bool isEqual(V value, E expected)
Undocumented in source. Be warned that the author may not have intended to support it.
should
auto should(E expr)
Undocumented in source. Be warned that the author may not have intended to support it.
shouldApproxEqual
void shouldApproxEqual(V value, E expected, double maxRelDiff, double maxAbsDiff, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
shouldBeEmpty
void shouldBeEmpty(R rng, string file, size_t line)

Verify that rng is empty.

shouldBeEmpty
void shouldBeEmpty(shared(R) rng, string file, size_t line)

Verify that rng is empty.

shouldBeEmpty
void shouldBeEmpty(T aa, string file, size_t line)

Verify that aa is empty.

shouldBeFalse
void shouldBeFalse(E condition, string file, size_t line)

Verify that the condition is false.

shouldBeGreaterThan
void shouldBeGreaterThan(T t, U u, string file, size_t line)

Verify that t is greater than u.

shouldBeIn
void shouldBeIn(T value, U container, string file, size_t line)

* Verify that the value is in the container. * Throws: UnitTestException on failure

shouldBeIn
void shouldBeIn(T value, U container, string file, size_t line)

Verify that the value is in the container.

shouldBeNull
void shouldBeNull(T value, string file, size_t line)

Verify that the value is null.

shouldBeSameJsonAs
void shouldBeSameJsonAs(string actual, string expected, string file, size_t line)

If two strings represent the same JSON regardless of formatting

shouldBeSameSetAs
void shouldBeSameSetAs(V value, E expected, string file, size_t line)

Verify that t and u represent the same set (ordering is not important).

shouldBeSmallerThan
void shouldBeSmallerThan(T t, U u, string file, size_t line)

Verify that t is smaller than u.

shouldBeTrue
void shouldBeTrue(E condition, string file, size_t line)

Verify that the condition is true.

shouldEqual
void shouldEqual(V value, E expected, string file, size_t line)

Verify that two values are the same. Floating point values are compared using std.math.approxEqual.

shouldNotBeEmpty
void shouldNotBeEmpty(R rng, string file, size_t line)

Verify that rng is not empty.

shouldNotBeEmpty
void shouldNotBeEmpty(T aa, string file, size_t line)

Verify that aa is not empty.

shouldNotBeIn
void shouldNotBeIn(T value, U container, string file, size_t line)

Verify that the value is not in the container.

shouldNotBeIn
void shouldNotBeIn(T value, U container, string file, size_t line)

Verify that the value is not in the container.

shouldNotBeNull
void shouldNotBeNull(T value, string file, size_t line)

Verify that the value is not null.

shouldNotBeSameSetAs
void shouldNotBeSameSetAs(V value, E expected, string file, size_t line)

Verify that value and expected do not represent the same set (ordering is not important).

shouldNotEqual
void shouldNotEqual(V value, E expected, string file, size_t line)

Verify that two values are not the same.

shouldNotThrow
void shouldNotThrow(E expr, string file, size_t line)

Verify that expr does not throw the templated Exception class.

shouldThrow
auto shouldThrow(E expr, string file, size_t line)

Verify that expr throws the templated Exception class. This succeeds if the expression throws a child class of the template parameter.

shouldThrowExactly
auto shouldThrowExactly(E expr, string file, size_t line)

Verify that expr throws the templated Exception class. This only succeeds if the expression throws an exception of the exact type of the template parameter.

shouldThrowWithMessage
void shouldThrowWithMessage(E expr, string msg, string file, size_t line)

Verify that an exception is thrown with the right message

Templates

IsField
template IsField(A...)
Undocumented in source.

Meta