diff options
author | Emmanuel Fleury <emmanuel.fleury@gmail.com> | 2022-03-16 09:31:31 +0100 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2022-05-26 18:37:35 +0100 |
commit | d97c1a148e65c1acdc3682ad279891973bab5371 (patch) | |
tree | 647f85f516f9f38da07dc5b75c5d31d343b88df2 /tests | |
parent | 94ef5ae4c719addf531c8d1e2bf7ca3e5462ffe4 (diff) | |
download | glib-d97c1a148e65c1acdc3682ad279891973bab5371.tar.gz |
Convert tests/refcount/properties4.c to glib test framework
Diffstat (limited to 'tests')
-rw-r--r-- | tests/refcount/properties4.c | 24 |
1 files changed, 16 insertions, 8 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); +} + +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 0; + return g_test_run (); } |