www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - unittest and assert

reply "ElfQT" <dethjunk yahoo.com> writes:
Is it true that the first assert that fails breaks the execution?
That's not a nice thing.

Unittest run should report all succeeding and failing cases in one run!

Also, assert badly needs a message (to write when assert fails) part.
Assert should report module,class,method not only the line number.

And for me, a bit strange that unittests will run on first execution. Should 
be a different run.
(If I am making a lib, do I have to make an executable out of it to unittest 
it?)

ElfQT
Sep 03 2005
next sibling parent reply "ElfQT" <dethjunk yahoo.com> writes:
 Unittest run should report all succeeding and failing cases in one run!

 Also, assert badly needs a message (to write when assert fails) part.
 Assert should report module,class,method not only the line number.
Well, I figured it out that I can implement these on my own with a custom unittest class. (Using writefln, __FILE__, __LINE__) ElfQT
Sep 03 2005
parent "ElfQT" <dethjunk yahoo.com> writes:
 Well, I figured it out that I can implement these on my own with a custom
 unittest class.
 (Using writefln, __FILE__, __LINE__)
OK, or maybe not that nice, because I only can include __FILE__ and __LINE__ at every single assert call, and not in the class doing the reporting... (Since no #define or such. Should a mixin help?)
Sep 03 2005
prev sibling next sibling parent "ElfQT" <dethjunk yahoo.com> writes:
 Also, assert badly needs a message (to write when assert fails) part.
 Assert should report module,class,method not only the line number.
As I begun to think about it, with the "nunit" unit testing framework (for the AssertEquals(<ValueofVariable>, <ExpectedValue>, <message>) format become the standard, because then the framework is able to report the value of the variable failing and the expected value. ElfQT
Sep 03 2005
prev sibling parent "Charles" <noone nowhere.com> writes:
 Unittest run should report all succeeding and failing cases in one run!
Yea I agree , I think most people do.
 And for me, a bit strange that unittests will run on first execution.
Should
 be a different run.
Yea , built in unit tests seem a good idea, but there are serious limitations to the existing ones , I think most people will just build their own framework. Charlie "ElfQT" <dethjunk yahoo.com> wrote in message news:dfd0li$kql$1 digitaldaemon.com...
 Is it true that the first assert that fails breaks the execution?
 That's not a nice thing.

 Unittest run should report all succeeding and failing cases in one run!

 Also, assert badly needs a message (to write when assert fails) part.
 Assert should report module,class,method not only the line number.

 And for me, a bit strange that unittests will run on first execution.
Should
 be a different run.
 (If I am making a lib, do I have to make an executable out of it to
unittest
 it?)

 ElfQT
Sep 04 2005