On 9/18/16 8:14 AM, Andrei Alexandrescu wrote:
On 9/18/16 6:00 AM, Jonathan M Davis via Digitalmars-d wrote:
Yes. That's DIP 82:


I need to go over it again and then introduce it into the new DIP
But I really think that that's where we should go to fix this problem.

Just a thought: things that we can't do have high priority. Things that
we can do with a modest cost are much less attractive. Consider:

struct Awesome(A, B, C)
    private enum ut = is(A == int) && is(B == int) && is(C == int);

    static if (ut) unittest

You're looking at an overhead with a small fixed cost plus a few
characters ("if (ut)") per unittest.

This is exactly how I did RedBlackTree unit tests:


This is still less than ideal, and has caused some real problems over the years. e.g.:


The best solution IMO is not to run templated unit tests unless specifically requested. Perhaps only run them when instantiated inside a unittest block?

All that being said, running unit tests on EVERY integral type caught about 3 bugs in the compiler when I was creating dcollections, and found several corner-case bugs in my code as well. It was well worth the "overhead" IMO.


Reply via email to