dunit.toolkit

Assert toolkit for more expressive unit testing.

Many methods implement compile-time parameters (file, line) that are set at the call site. It is preferred that these parameters are ignored when using these methods.

Members

Functions

assertApprox
void assertApprox(A value, B target, long ulps, string message, string file, size_t line)

Assert that two floating point values are approximately equal.

assertApprox
void assertApprox(A value, B target, double epsilon, string message, string file, size_t line)

Assert that two floating point values are approximately equal using an epsilon value.

assertCount
void assertCount(A array, ulong count, string message, string file, size_t line)

Assert that an array contains a particular value count.

assertEmpty
void assertEmpty(A array, string message, string file, size_t line)

Assert that an array is empty.

assertEmpty
void assertEmpty(R range, string message, string file, size_t line)

Assert that a range is empty.

assertEndsWith
void assertEndsWith(string value, string suffix, string message, string file, size_t line)

Assert that a string ends with a particular string.

assertEqual
void assertEqual(A value, B target, string message, string file, size_t line)

Assert that two values are equal.

assertFalse
void assertFalse(T value, string message, string file, size_t line)

Assert that a boolean value is false.

assertFalsey
void assertFalsey(T value, string message, string file, size_t line)

Assert that a value evaluates as false.

assertGreaterThan
void assertGreaterThan(A value, B threshold, string message, string file, size_t line)

Assert that a value is greater than a threshold value.

assertGreaterThanOrEqual
void assertGreaterThanOrEqual(A value, B threshold, string message, string file, size_t line)

Assert that a value is greater than or equal to a threshold value.

assertHasKey
void assertHasKey(A haystack, B needle, string message, string file, size_t line)

Assert that an associative array contains a particular key.

assertHasValue
void assertHasValue(A haystack, B needle, string message, string file, size_t line)

Assert that an array contains a particular value.

assertInstanceOf
void assertInstanceOf(B value, string message, string file, size_t line)

Assert that a value is an instance of a type.

assertLessThan
void assertLessThan(A value, B threshold, string message, string file, size_t line)

Assert that a value is less than a threshold value.

assertLessThanOrEqual
void assertLessThanOrEqual(A value, B threshold, string message, string file, size_t line)

Assert that a value is less than or equal to a threshold value.

assertMatchRegex
void assertMatchRegex(string value, string pattern, string message, string file, size_t line)

Assert that a string matches a regular expression.

assertNull
void assertNull(A value, string message, string file, size_t line)

Assert that a value is null.

assertStartsWith
void assertStartsWith(string value, string prefix, string message, string file, size_t line)

Assert that a string starts with a particular string.

assertThrow
void assertThrow(B expression, string expressionMsg, string message, string file, size_t line)

Assert that an expression throws an exception.

assertTrue
void assertTrue(T value, string message, string file, size_t line)

Assert that a boolean value is true.

assertTruthy
void assertTruthy(T value, string message, string file, size_t line)

Assert that a value evaluates as true.

assertType
void assertType(B value, string message, string file, size_t line)

Assert that a value is of a particular type.

Meta

License

MIT. See LICENSE for full details.