std.unittests [updated] for review
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Jan 24 07:48:25 PST 2011
Maybe if we get that "any" function any time soon (pardon the pun), we
could simplify those constraints a little bit:
enum string[] binaryOps = ["+", "-", "*", "/", "%", "^^", "&", "|",
"^", "<<", ">>", ">>>", "~"];
void assertPred(string op, L, R, E)
(L lhs, R rhs, E expected, lazy string msg = null,
string file = __FILE__, size_t line = __LINE__)
if(any(op, binaryOps) &&
__traits(compiles, mixin("lhs " ~ op ~ " rhs")) &&
__traits(compiles, mixin("(lhs " ~ op ~ " rhs) == expected")) &&
isPrintable!L &&
isPrintable!R)
{
}
I don't recall what any will look like exactly, but something like
that could work I guess.
More information about the Digitalmars-d
mailing list