shouldNotBeIn

Verify that the value is not in the container.

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

Throws

UnitTestException on failure

Examples

1 auto arrayRangeWithoutLength(T)(T[] array)
2 {
3     struct ArrayRangeWithoutLength(T)
4     {
5     private:
6         T[] array;
7     public:
8         T front() const @property
9         {
10             return array[0];
11         }
12 
13         void popFront()
14         {
15             array = array[1 .. $];
16         }
17 
18         bool empty() const @property
19         {
20             return array.empty;
21         }
22     }
23     return ArrayRangeWithoutLength!T(array);
24 }
25 shouldNotBeIn(3.5, [1.1, 2.2, 4.4]);
26 shouldNotBeIn(1.0, [2.0 : 1, 3.0 : 2]);
27 shouldNotBeIn(1, arrayRangeWithoutLength([2, 3, 4]));
28 assertFail(1.shouldNotBeIn(arrayRangeWithoutLength([1, 2, 3])));
29 assertFail("foo".shouldNotBeIn(["foo"]));

Meta