Cool stuff! I'll have a look later. Thanks.<br><br><div class="gmail_quote">On Sat, Aug 7, 2010 at 9:53 PM, Nick Sabalausky <span dir="ltr"><a@a.a></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
"Andrej Mitrovic" <<a href="mailto:andrej.mitrovich@gmail.com">andrej.mitrovich@gmail.com</a>> wrote in message<br>
news:mailman.175.1281208901.13841.digitalmars-d@puremagic.com...<br>
<div class="im">> You know, I just had an idea. It would be really cool to have some sort of<br>
> generalized template function which can test other functions in various<br>
> ways. You could pass strings as options, where you might choose the type<br>
> of<br>
> testing being done, such as verification tests or performance tests.. Or<br>
> if<br>
> a function is designed to write a file on disk, maybe you'd want to have<br>
> an<br>
> option for the maximum number of tests to run on that function (you don't<br>
> want to be left with 10000 files written in some temp directory<br>
> somewhere..), or a test to see if a function will fail with invalid input,<br>
> etc.<br>
><br>
> Well it's just an idea, I better take a look at the existing test<br>
> frameworks<br>
> and see how it's done there.<br>
><br>
<br>
</div>Probably not quite as fancy as what you're talking about, but my SemiTwist D<br>
Tools library has a module that includes something that's similar to assert<br>
but:<br>
<br>
- Allows to you verify that a particular statement throws a particular type<br>
of exception.<br>
- Properly reports if an expression throws (and you didn't expect it to).<br>
- Doesn't abort the program on failure.<br>
- Reports "expected" expression and "actual" value.<br>
<br>
<a href="http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/apps/tests/deferAssertTest/main.d" target="_blank">http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/apps/tests/deferAssertTest/main.d</a><br>
<a href="http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/deferAssert.d" target="_blank">http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/deferAssert.d</a><br>
<br>
It does need some clean-up and improvements, but it at least works.<br>
(Although, trunk is currently in the process of switching from D1/Tango to<br>
D2/Phobos, so the latest revisions might be broken and it definitely doesn't<br>
take advantage of D2-specific features yet. But the version included with<br>
Goldie 0.3 does work fine on D1/Tango though).<br>
<br>
<br>
</blockquote></div><br>