On Mon, Dec 06, 2004 at 02:25:42PM -0800, Andrew Savige wrote:
> --- Michael G Schwern <[EMAIL PROTECTED]> wrote:
> > Why add that extra auto-sprintf complexity?  Can't the user do the exact
> > same thing with:
> > 
> >     ok(some_func(i), sprintf("some_func(%d)", i));
> 
> No. sprintf in C needs a buffer and you don't know how big to make it.

If the user doesn't know how will ok() know how big to make it?


> > >     ok(1 == 1, "1 equals one"); /* PRINT: ok 1 - 1 equals 1 */
> > >     ok2(1 == 2);                /* PRINT: not ok 2 - 1 == 2 */
> > 
> > Why the split?  You can do variable length argument lists in C.
> 
> Not with the pre-processor. And you need the pre-processor for
> __LINE__ and __FILE__.
> 
> An alternative is to drop the ugly ok2() and force the test writer
> to use:
> 
>       ok(1 == 2, "");
> 
> I prefer that since I want to make it hard for people to avoid giving
> a test a name, er, comment.

At the very least some better name than ok2().


> > > Finally, there's exit_status(), which returns an int suitable for use
> > > when return'ing from main(), or calling exit().  You should always do one
> > > of:
> > > 
> > >     return exit_status();
> > >     exit(exit_status());
> > 
> > What is this for?  <--- possible C ignorance
> > 
> > I hope you're not emulating Test::More's exit code == # of tests failed
> > "feature" that I'm planning on getting rid of.
> 
> I tried returning the number of failed tests in the exit status in
> a C++ regression test suite a while back and dropped it because:
> i) you are limited to 0-255 for this exit status;

For informational purposes...

TM gets around this by just declaring 254 to mean "254 failures or more".
If you have more than 254 failures something tells me the exact number isn't
all that important. :)


> ii) you can always tell the number of failed tests by parsing stdout;

Assuming you have a parser that's quiet.  This is less than simple with 
Test::Harness at the moment.


> iii) it's nice to cleanly detect a program crash; if it don't
> return zero, it crashed.

Yeah, I agree with that.


-- 
Michael G Schwern        [EMAIL PROTECTED]  http://www.pobox.com/~schwern/
Quit looking, kids!  It'll EAT YOUR MIND!!
        -- http://www.angryflower.com/fuck.gif

Reply via email to