From d97c1a148e65c1acdc3682ad279891973bab5371 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 16 Mar 2022 09:31:31 +0100 Subject: [PATCH] Convert tests/refcount/properties4.c to glib test framework --- tests/refcount/properties4.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/refcount/properties4.c b/tests/refcount/properties4.c index d4bca9486..462f9e3cd 100644 --- a/tests/refcount/properties4.c +++ b/tests/refcount/properties4.c @@ -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 (); }