unit-threaded v0.6.5 - Type-parametrized tests
Atila Neves via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Wed Mar 9 10:01:49 PST 2016
The forum must be sick of hearing from me... :P For those not in
the know, unit-threaded is an advanced unit testing library for D:
http://code.dlang.org/packages/unit-threaded
The v0.6.3 release had tests parametrized by value; this v0.6.5
release brings with it the possibility of parametrizing tests by
type, like so:
@Types!(int, byte)
void testInit(T)() {
assert(T.init == 0);
}
This will run the testInit code twice, once for each type, and
report them as separate tests:
tests.pass.attributes.testInit.int:
tests.pass.attributes.testInit.byte:
I've literally only written that silly testInit example yet. But
imagine how easy it'd be to test, say, different input ranges.
I'm thinking of ways of getting the parametrized tests to work
with the built-in unittest blocks. I assume it'll be hacky. Right
now it's the only thing that requires non-standard test functions
and I'm trying to augment the existing unit testing features of D
instead of replacing them.
Atila
More information about the Digitalmars-d-announce
mailing list