GLib Testframework API



Sorry for being late in the game for comments, but here we go.

In general this api differs slightly from JUnit/python, which has the following (main) methods:

 assertEqual
 assertNotEqual
 assertTrue
 assertFalse
 assertRaises

Perhaps the term "equals" could be used instead of "cmp".

assertTrue is g_assert, but assertFalse is missing.
I know it is easy to just put an ! in the beginning of the expression, but it is easier to read if it is explicitly visible in the function/macro name.

I haven't looked in detail at the trap api, but having something similar to assertRaises for g_error & friends would be a good thing.

g_assert_cmpstr, accepts a comparison operator, while this makes sense for comparing floats and integers I don't think it should be included in the api for strings. Basically, the only thing you want to check if is a string is equal to another or not, so perhaps it could be replaced with:

  g_assert_equals_str
  g_assert_not_equals_str

Or do you see a use case for using other operators besides == and != ?

Johan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]