On Nov 6, 2007, at 2:40 PM, Matthias Clasen wrote:

> On Nov 6, 2007 2:19 PM, Tim Janik <[EMAIL PROTECTED]> wrote:
>> however if you want the value of 'foo' and 'bar' be printed out,  
>> instead
>> of just the value of (foo > bar) which would be 0 or 1, then there  
>> are
>> no other means than using something simialr to:
>>   g_assert_cmpfloat (foo, >, bar);
>
>
> Hmm, thats unfortunately true. Unless we want to go for something more
> heavy-weight,
> like
>
> g_assert_with_message (foo > bar, "foo is not greateer than bar (%d >
> %d)", foo, bar)

Or, of course, the less general, cryptic, i-can-never-remember-which- 
arg-is-which suite of specific symbols:

     g_assert_lt (foo, bar); /* foo less-than bar */
     g_assert_ge (foo, bar); /* foo greater-than or equal-to bar */
     g_assert_eq (foo, bar); /* foo equal to bar */
     g_assert_deq (foo, bar); /* "double equal", using an epsilon */
     g_assert_streq (foo, bar); /* "string equal" */
     ...

That's kinda icky, unfortunately.

When the test fails, the first two things you want to know are "which  
test?" and "what were the values?"  Numbered tests, or tests which  
only say "failed", really don't help, because they send you first to  
the debugger or into your editor to add a printf().  Making it  
painless and automatic to express tests and get that functionality  
should be a high priority for the API design here.  To that end i  
think Tim's proposed API is alright.


--
If the monkey could type one keystroke every nanosecond, the expected  
waiting time until the monkey types out Hamlet is so long that the  
estimated age of the universe is insignificant by comparison ... this  
is not a practical method for writing plays.
   -- Gian-Carlo Rota


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to