unit_threaded.should

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

Public Imports

unit_threaded.attrs
public import unit_threaded.attrs;
Undocumented in source.

Members

Classes

UnitTestException
class UnitTestException

An exception to signal that a test case has failed.

Functions

fail
void fail(string output, 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(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.

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
void 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
void 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

Meta