shouldBeSameSetAs

Verify that t and u represent the same set (ordering is not important).

void
shouldBeSameSetAs
(
V
E
)
(
auto ref V value
,
auto ref E expected
,
string file = __FILE__
,
size_t line = __LINE__
)
if (
isInputRange!V &&
isInputRange!E
&&
is(typeof(value.front != expected.front) == bool)
)

Throws

UnitTestException on failure.

Examples

import std.range: iota;

auto inOrder = iota(4);
auto noOrder = [2, 3, 0, 1];
auto oops = [2, 3, 4, 5];

inOrder.shouldBeSameSetAs(noOrder);
inOrder.shouldBeSameSetAs(oops).shouldThrow!UnitTestException;

struct Struct
{
    int i;
}

[Struct(1), Struct(4)].shouldBeSameSetAs([Struct(4), Struct(1)]);

Meta