shouldBeIn

Used to assert that one value is in an array of specified values.

void
shouldBeIn
(
T
U
)
(
,,
string file = __FILE__
,
size_t line = __LINE__
)

Parameters

value
Type: T

The value to test.

valid_values
Type: U[]

An array of valid values.

file
Type: string

The file name that the assert failed in. Should be left as default.

line
Type: size_t

The file line that the assert failed in. Should be left as default.

Throws

If the value is not in the array, will throw an AssertError with the value and array values.

Examples

// Will throw an exception like "AssertError@example.d(6): <Bobrick> is not in <[Tim, Al]>."
"Bobrick".shouldBeIn(["Tim", "Al"]);

Meta