Convert tests/refcount/properties4.c to glib test framework

This commit is contained in:
Emmanuel Fleury 2022-03-16 09:31:31 +01:00 committed by Philip Withnall
parent 94ef5ae4c7
commit d97c1a148e

View File

@ -143,19 +143,15 @@ my_badger_mama_notify (GObject *object,
MyBadger *self;
self = MY_BADGER (object);
self->mama_notify_count++;
}
int
main (int argc, char **argv)
static void
test_refcount_properties_4 (void)
{
MyBadger * badger1, * badger2;
gpointer test;
g_print ("START: %s\n", argv[0]);
g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
badger1 = g_object_new (MY_TYPE_BADGER, NULL);
badger2 = g_object_new (MY_TYPE_BADGER, NULL);
@ -163,11 +159,23 @@ main (int argc, char **argv)
g_assert_cmpuint (badger1->mama_notify_count, ==, 1);
g_assert_cmpuint (badger2->mama_notify_count, ==, 1);
g_object_get (badger1, "mama", &test, NULL);
g_assert (test == badger2);
g_assert_cmpmem (test, sizeof (MyBadger), badger2, sizeof (MyBadger));
g_object_unref (test);
g_object_unref (badger1);
g_object_unref (badger2);
return 0;
}
int
main (int argc, gchar *argv[])
{
g_log_set_always_fatal (G_LOG_LEVEL_WARNING |
G_LOG_LEVEL_CRITICAL |
g_log_set_always_fatal (G_LOG_FATAL_MASK));
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/gobject/refcount/properties-4", test_refcount_properties_4);
return g_test_run ();
}