Unittest Absurdity

jfondren julian.fondren at gmail.com
Fri Aug 5 01:42:23 UTC 2022


On Friday, 5 August 2022 at 01:38:48 UTC, jfondren wrote:

Here's a complete example that passes tests:

```d
struct S {
     int n;
     void opOpAssign(string op)(S rhs) if (op == "/") {
         n++;
     }
}

unittest {
     auto a = S(1), b = S(2);
     a /= b;
     b /= a;
     assert(a.n == 2);
     assert(b.n == 3);
}
```


More information about the Digitalmars-d-learn mailing list