assertShapeEqual

testing function for shape equality

pure nothrow @nogc
void
assertShapeEqual
(
L
R
)
(
L lhs
,
R rhs
)
if (
isSlice!L &&
isSlice!R
)

Examples

import mir.ndslice : iota;
import core.exception;

// test OK
assertShapeEqual(iota(3, 4), iota(3, 4));
assertShapeEqual(iota(0), iota(0));

// test NG
static assert(!__traits(compiles, assertShapeEqual(iota(3, 4), iota(3, 4, 5))));
try
{
    assertShapeEqual(iota(3, 4), iota(3, 2));
    assert(false);
}
catch (AssertError)
{
    // OK!
}

Meta