On Tue, Dec 07, 2004 at 12:55:01PM +1100, Andrew Savige wrote: > 3) Implementing cmp_ok() in C is a challenge. ;-) > > xUnit/cutest have things like: > > AssertStrEquals > AssertIntEquals > ... > > The trouble with plain old ok() is that investigating test failures > is a pest. I suppose you could support equals for the basic C types. > For example: > > cmp_ok_int_equals > cmp_ok_double_equals > cmp_ok_cstr_equals > cmp_ok_mem_equals > ... > > and so on. In the cstr/mem case, you can have the function check > for NULL pointers and give a nice diagnostic rather than crashing.
Yucko. Test::More implements cmp_ok() using an eval. Could a macro prove useful here to do something similar? cmp_ok(foo, 'int', '==', bar); -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern/ I am the soul of honor, kindness, mercy, and goodness. Trust me in all things. -- Corwin, "Guns of Avalon"