From 97590d6071d8deb82e09794119c9e680a3488c49 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 26 Mar 2021 12:16:57 +0000 Subject: test: Compare integers using g_assert_cmpint(), g_assert_cmpuint() Signed-off-by: Simon McVittie --- dbus/dbus-gobject.c | 34 +++++++++++++++++----------------- dbus/dbus-gvalue.c | 16 ++++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c index f0942e8..ad5ee8b 100644 --- a/dbus/dbus-gobject.c +++ b/dbus/dbus-gobject.c @@ -3333,67 +3333,67 @@ _dbus_gobject_test (const char *test_data_dir) /* DoNothing */ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info, &(dbus_glib_internal_test_methods[0])); - g_assert (*arg == '\0'); + g_assert_cmpint (*arg, ==, '\0'); /* Increment */ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info, &(dbus_glib_internal_test_methods[1])); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); g_assert_cmpstr (arg_name, ==, "x"); g_assert (arg_in == TRUE); g_assert_cmpstr (arg_signature, ==, "u"); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); g_assert (arg_in == FALSE); - g_assert (retval == RETVAL_NONE); + g_assert_cmpint (retval, ==, RETVAL_NONE); g_assert_cmpstr (arg_signature, ==, "u"); - g_assert (*arg == '\0'); + g_assert_cmpint (*arg, ==, '\0'); /* IncrementRetval */ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info, &(dbus_glib_internal_test_methods[2])); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); g_assert_cmpstr (arg_name, ==, "x"); g_assert (arg_in == TRUE); g_assert_cmpstr (arg_signature, ==, "u"); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); - g_assert (retval == RETVAL_NOERROR); + g_assert_cmpint (retval, ==, RETVAL_NOERROR); g_assert (arg_in == FALSE); g_assert_cmpstr (arg_signature, ==, "u"); - g_assert (*arg == '\0'); + g_assert_cmpint (*arg, ==, '\0'); /* IncrementRetvalError */ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info, &(dbus_glib_internal_test_methods[3])); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); g_assert_cmpstr (arg_name, ==, "x"); g_assert (arg_in == TRUE); g_assert_cmpstr (arg_signature, ==, "u"); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); - g_assert (retval == RETVAL_ERROR); + g_assert_cmpint (retval, ==, RETVAL_ERROR); g_assert (arg_in == FALSE); g_assert_cmpstr (arg_signature, ==, "u"); - g_assert (*arg == '\0'); + g_assert_cmpint (*arg, ==, '\0'); /* Stringify */ arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info, &(dbus_glib_internal_test_methods[8])); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); g_assert_cmpstr (arg_name, ==, "val"); g_assert (arg_in == TRUE); g_assert_cmpstr (arg_signature, ==, "v"); - g_assert (*arg != '\0'); + g_assert_cmpint (*arg, !=, '\0'); arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature); - g_assert (retval == RETVAL_NONE); + g_assert_cmpint (retval, ==, RETVAL_NONE); g_assert (arg_in == FALSE); g_assert_cmpstr (arg_signature, ==, "s"); - g_assert (*arg == '\0'); + g_assert_cmpint (*arg, ==, '\0'); sigdata = dbus_glib_internal_test_object_info.exported_signals; g_assert (*sigdata != '\0'); diff --git a/dbus/dbus-gvalue.c b/dbus/dbus-gvalue.c index bd97e65..534e90a 100644 --- a/dbus/dbus-gvalue.c +++ b/dbus/dbus-gvalue.c @@ -2036,7 +2036,7 @@ assert_type_maps_to (GType gtype, const char *expected_sig) static void assert_signature_maps_to (const char *sig, GType expected_gtype) { - g_assert (_dbus_gtype_from_signature (sig, TRUE) == expected_gtype); + g_assert_cmpuint (_dbus_gtype_from_signature (sig, TRUE), ==, expected_gtype); } static void @@ -2074,26 +2074,26 @@ _dbus_gvalue_test (const char *test_data_dir) DBUS_STRUCT_BEGIN_CHAR_AS_STRING DBUS_TYPE_INT32_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_OBJECT_PATH_AS_STRING DBUS_STRUCT_END_CHAR_AS_STRING ); rectype = dbus_g_type_get_collection ("GArray", G_TYPE_UINT); - g_assert (rectype != G_TYPE_INVALID); + g_assert_cmpuint (rectype, !=, G_TYPE_INVALID); g_assert_cmpstr (g_type_name (rectype), ==, "GArray_guint_"); type = _dbus_gtype_from_signature ("au", TRUE); - g_assert (type == rectype); + g_assert_cmpuint (type, ==, rectype); rectype = dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING); - g_assert (rectype != G_TYPE_INVALID); + g_assert_cmpuint (rectype, !=, G_TYPE_INVALID); g_assert_cmpstr (g_type_name (rectype), ==, "GHashTable_gchararray+gchararray_"); type = _dbus_gtype_from_signature ("a{ss}", TRUE); - g_assert (type == rectype); + g_assert_cmpuint (type, ==, rectype); type = _dbus_gtype_from_signature ("o", FALSE); - g_assert (type == DBUS_TYPE_G_OBJECT_PATH); + g_assert_cmpuint (type, ==, DBUS_TYPE_G_OBJECT_PATH); type = _dbus_gtype_from_signature ("o", TRUE); - g_assert (type == DBUS_TYPE_G_OBJECT_PATH); + g_assert_cmpuint (type, ==, DBUS_TYPE_G_OBJECT_PATH); type = _dbus_gtype_from_signature ("g", TRUE); - g_assert (type == DBUS_TYPE_G_SIGNATURE); + g_assert_cmpuint (type, ==, DBUS_TYPE_G_SIGNATURE); return TRUE; } -- cgit v1.2.1