How do I get unittests to actually execute operator overloads?
E.g.:
struct Struct
{
void opOpAssign(string op)(Struct rhs) //Assume that the operator `/=` is implemented here
{
//...
}
}
unittest
{
Struct a = Struct(1);
Struct b = Struct(2);
a /= b;
assert(a == Struct(5, 0, -1));
}
The unittest completely ignores the a /= b
.
Unittests also ignore swapping a
for a/b
in the assert
statement, and even if I force the operator overloads to give me the correct answers, the assert
still fails.
Any function other than an operator overload seems to work fine.