X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgtestutils.h;h=2e27a2a64e03b993b5c6eeeb47a36c56590c8a3f;hb=ea4f9ce8a060d53cbc299e4c384089f6cc926caa;hp=446d722c7e2e648e6b1b3a7e6249842606332d99;hpb=88eaefb9d5f52bedf34a359b21c62f3c2cb95f20;p=platform%2Fupstream%2Fglib.git diff --git a/glib/gtestutils.h b/glib/gtestutils.h index 446d722..2e27a2a 100644 --- a/glib/gtestutils.h +++ b/glib/gtestutils.h @@ -13,9 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library; if not, see . */ #ifndef __G_TEST_UTILS_H__ @@ -66,14 +64,33 @@ typedef void (*GTestFixtureFunc) (gpointer fixture, #define g_assert_error(err, dom, c) do { if (!err || (err)->domain != dom || (err)->code != c) \ g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ #err, err, dom, c); } while (0) +#define g_assert_true(expr) do { if G_LIKELY (expr) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should be TRUE"); \ + } while (0) +#define g_assert_false(expr) do { if G_LIKELY (!(expr)) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should be FALSE"); \ + } while (0) +#define g_assert_null(expr) do { if G_LIKELY ((expr) == NULL) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should be NULL"); \ + } while (0) +#define g_assert_nonnull(expr) do { if G_LIKELY ((expr) != NULL) ; else \ + g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + "'" #expr "' should not be NULL"); \ + } while (0) #ifdef G_DISABLE_ASSERT #define g_assert_not_reached() do { (void) 0; } while (0) #define g_assert(expr) do { (void) 0; } while (0) +#define g_assert_se(expr) ((void) (expr)) #else /* !G_DISABLE_ASSERT */ -#define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) +#define g_assert_not_reached() do { g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) #define g_assert(expr) do { if G_LIKELY (expr) ; else \ g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #expr); } while (0) + #expr); \ + } while (0) +#define g_assert_se(expr) g_assert((expr)) #endif /* !G_DISABLE_ASSERT */ GLIB_AVAILABLE_IN_ALL @@ -94,7 +111,7 @@ void g_test_maximized_result (double maximized_quantity, GLIB_AVAILABLE_IN_ALL void g_test_init (int *argc, char ***argv, - ...); + ...) G_GNUC_NULL_TERMINATED; /* query testing framework config */ #define g_test_initialized() (g_test_config_vars->test_initialized) #define g_test_quick() (g_test_config_vars->test_quick) @@ -133,6 +150,10 @@ GLIB_AVAILABLE_IN_2_38 void g_test_incomplete (const gchar *msg); GLIB_AVAILABLE_IN_2_38 void g_test_skip (const gchar *msg); +GLIB_AVAILABLE_IN_2_38 +gboolean g_test_failed (void); +GLIB_AVAILABLE_IN_2_38 +void g_test_set_nonfatal_assertions (void); /* hook up a test with fixture under test path */ #define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \ @@ -250,7 +271,7 @@ void g_assertion_message (const char *domain, const char *file, int line, const char *func, - const char *message) G_GNUC_NORETURN; + const char *message); GLIB_AVAILABLE_IN_ALL void g_assertion_message_expr (const char *domain, const char *file, @@ -265,7 +286,7 @@ void g_assertion_message_cmpstr (const char *domain, const char *expr, const char *arg1, const char *cmp, - const char *arg2) G_GNUC_NORETURN; + const char *arg2); GLIB_AVAILABLE_IN_ALL void g_assertion_message_cmpnum (const char *domain, const char *file, @@ -275,7 +296,7 @@ void g_assertion_message_cmpnum (const char *domain, long double arg1, const char *cmp, long double arg2, - char numtype) G_GNUC_NORETURN; + char numtype); GLIB_AVAILABLE_IN_ALL void g_assertion_message_error (const char *domain, const char *file, @@ -284,7 +305,7 @@ void g_assertion_message_error (const char *domain, const char *expr, const GError *error, GQuark error_domain, - int error_code) G_GNUC_NORETURN; + int error_code); GLIB_AVAILABLE_IN_ALL void g_test_add_vtable (const char *testpath, gsize data_size, @@ -355,7 +376,7 @@ void g_test_log_msg_free (GTestLogMsg *tmsg); * * Specifies the prototype of fatal log handler functions. * - * Return value: %TRUE if the program should abort, %FALSE otherwise + * Returns: %TRUE if the program should abort, %FALSE otherwise * * Since: 2.22 */