On 2016-03-10 12:05, Atila Neves wrote:

No, sorry. I haven't needed it yet. Something like this?

Yes.

@Types!(int, string)
void testArray(T)() {
     import std.container;

     auto arr = Array!T();
     arr.empty.shouldBeTrue;

     arr.insertBack(T.init);
     arr.empty.shouldBeFalse;
     auto l = arr.length;
     l.shouldEqual(1);
}

I'm trying to think how this would be useful. Would you want to test with different values than T.init? Or is there some library that can generate random values based on a type?

What about user defined types? T.init my not be useful at all.

I don't want to sound negative but I'm trying to see the use cases.

--
/Jacob Carlborg

Reply via email to