shouldNotBeIn

Verify that the value is not in the container.

  1. void shouldNotBeIn(T value, U container, string file, size_t line)
  2. void shouldNotBeIn(T value, U container, string file, size_t line)
    void
    shouldNotBeIn
    (
    T
    U
    )
    (
    const scope auto ref T value
    ,,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    isInputRange!U
    )

Throws

UnitTestException on failure

Examples

auto arrayRangeWithoutLength(T)(T[] array)
{
    struct ArrayRangeWithoutLength(T)
    {
    private:
        T[] array;
    public:
        T front() const @property
        {
            return array[0];
        }

        void popFront()
        {
            array = array[1 .. $];
        }

        bool empty() const @property
        {
            return array.empty;
        }
    }
    return ArrayRangeWithoutLength!T(array);
}

shouldNotBeIn(3.5, [1.1, 2.2, 4.4]);
shouldNotBeIn(1.0, [2.0 : 1, 3.0 : 2]);
shouldNotBeIn(1, arrayRangeWithoutLength([2, 3, 4]));

Meta