unittesting generic functions

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 13 21:02:27 PDT 2014


On Wed, Aug 13, 2014 at 06:10:54PM -0700, Andrei Alexandrescu via Digitalmars-d wrote:
> Destroy https://issues.dlang.org/show_bug.cgi?id=13291?
[...]

1) How to add attributes to the unittest without them clashing with the
function's attributes?

2) How to parse ddoc comments for the unittest?

3) Where should unittest block stand in relation to in/out contracts?

4) How much can you realistically test on a generic type argument T,
that you can't already cover with concrete types? I'm finding that the
per-instantiation behaviour of unittest blocks inside templated
structs/classes is rarely desired, esp. when you write ddoc unittests
(because you want code examples in the docs to involve concrete types,
not abstract types, otherwise they are of limited use to the reader).
Because of this, I often move unittests outside the aggregate or enclose
them in static if's. This suggests that perhaps per-instantiation
unittests are only of limited utility.


T

-- 
"A one-question geek test. If you get the joke, you're a geek:
Seen on a California license plate on a VW Beetle: 'FEATURE'..." --
Joshua D. Wachs - Natural Intelligence, Inc.


More information about the Digitalmars-d mailing list