unit_threaded.should

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

Members

Classes

UnitTestException
class UnitTestException

An exception to signal that a test case has failed.

Functions

shouldBeEmpty
void shouldBeEmpty(in auto ref R rng, in string file = __FILE__, in size_t line = __LINE__)

Verify that rng is empty.

shouldBeEmpty
void shouldBeEmpty(auto ref shared(R) rng, in string file = __FILE__, in size_t line = __LINE__)

Verify that rng is empty.

shouldBeEmpty
void shouldBeEmpty(auto ref T aa, in string file = __FILE__, in size_t line = __LINE__)

Verify that aa is empty.

shouldBeFalse
void shouldBeFalse(lazy E condition, in string file = __FILE__, in size_t line = __LINE__)

Verify that the condition is false.

shouldBeGreaterThan
void shouldBeGreaterThan(in auto ref T t, in auto ref U u, in string file = __FILE__, in size_t line = __LINE__)

Verify that t is greater than u.

shouldBeIn
void shouldBeIn(in auto ref T value, in auto ref U container, in string file = __FILE__, in size_t line = __LINE__)

Verify that the value is in the container.

shouldBeIn
void shouldBeIn(in auto ref T value, U container, in string file = __FILE__, in size_t line = __LINE__)

Verify that the value is in the container.

shouldBeNull
void shouldBeNull(in auto ref T value, in string file = __FILE__, in size_t line = __LINE__)

Verify that the value is null.

shouldBeSameJsonAs
void shouldBeSameJsonAs(in string actual, in string expected, in string file = __FILE__, in size_t line = __LINE__)

If two strings represent the same JSON regardless of formatting

shouldBeSameSetAs
void shouldBeSameSetAs(auto ref V value, auto ref E expected, in string file = __FILE__, in size_t line = __LINE__)

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

shouldBeSmallerThan
void shouldBeSmallerThan(in auto ref T t, in auto ref U u, in string file = __FILE__, in size_t line = __LINE__)

Verify that t is smaller than u.

shouldBeTrue
void shouldBeTrue(lazy E condition, in string file = __FILE__, in size_t line = __LINE__)

Verify that the condition is true.

shouldEqual
void shouldEqual(auto ref V value, auto ref E expected, in string file = __FILE__, in size_t line = __LINE__)

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

shouldNotBeEmpty
void shouldNotBeEmpty(R rng, in string file = __FILE__, in size_t line = __LINE__)

Verify that rng is not empty.

shouldNotBeEmpty
void shouldNotBeEmpty(in auto ref T aa, in string file = __FILE__, in size_t line = __LINE__)

Verify that aa is not empty.

shouldNotBeIn
void shouldNotBeIn(in auto ref T value, in auto ref U container, in string file = __FILE__, in size_t line = __LINE__)

Verify that the value is not in the container.

shouldNotBeIn
void shouldNotBeIn(in auto ref T value, U container, in string file = __FILE__, in size_t line = __LINE__)

Verify that the value is not in the container.

shouldNotBeNull
void shouldNotBeNull(in auto ref T value, in string file = __FILE__, in size_t line = __LINE__)

Verify that the value is not null.

shouldNotBeSameSetAs
void shouldNotBeSameSetAs(auto ref V value, auto ref E expected, in string file = __FILE__, in size_t line = __LINE__)

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

shouldNotEqual
void shouldNotEqual(V value, E expected, in string file = __FILE__, in size_t line = __LINE__)

Verify that two values are not the same.

shouldNotThrow
void shouldNotThrow(lazy E expr, in string file = __FILE__, in size_t line = __LINE__)

Verify that expr does not throw the templated Exception class.

shouldThrow
auto shouldThrow(lazy E expr, in string file = __FILE__, in size_t line = __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(lazy E expr, in string file = __FILE__, in size_t line = __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(lazy E expr, string msg, string file = __FILE__, size_t line = __LINE__)

Verify that an exception is thrown with the right message

Meta