[glib: 1/2] Removing tests/asyncqueue-test.c from tests/
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] Removing tests/asyncqueue-test.c from tests/
- Date: Tue, 30 Nov 2021 09:49:54 +0000 (UTC)
commit 074d0a79d9407d1f5ea2288720556c5bde29fcdd
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Wed Nov 17 18:56:09 2021 +0100
Removing tests/asyncqueue-test.c from tests/
Tests on async queues are already performed in a more extensive way in
glib/tests/asyncqueue.c. This test file can be safely removed without
any loss.
glib/tests/asyncqueue.c | 43 +++++++++
tests/asyncqueue-test.c | 244 ------------------------------------------------
tests/meson.build | 1 -
3 files changed, 43 insertions(+), 245 deletions(-)
---
diff --git a/glib/tests/asyncqueue.c b/glib/tests/asyncqueue.c
index c414e69c1..de8c47e07 100644
--- a/glib/tests/asyncqueue.c
+++ b/glib/tests/asyncqueue.c
@@ -78,6 +78,8 @@ test_async_queue_destroy (void)
{
GAsyncQueue *q;
+ destroy_count = 0;
+
q = g_async_queue_new_full (destroy_notify);
g_assert_cmpint (destroy_count, ==, 0);
@@ -268,11 +270,52 @@ test_async_queue_push_front (void)
g_async_queue_unref (q);
}
+static void
+test_basics (void)
+{
+ GAsyncQueue *q;
+ gpointer item;
+
+ destroy_count = 0;
+
+ q = g_async_queue_new_full (destroy_notify);
+ g_async_queue_lock (q);
+ g_async_queue_ref (q);
+ g_async_queue_unlock (q);
+ g_async_queue_lock (q);
+ g_async_queue_ref_unlocked (q);
+ g_async_queue_unref_and_unlock (q);
+
+ item = g_async_queue_try_pop (q);
+ g_assert_null (item);
+
+ g_async_queue_lock (q);
+ item = g_async_queue_try_pop_unlocked (q);
+ g_async_queue_unlock (q);
+ g_assert_null (item);
+
+ g_async_queue_push (q, GINT_TO_POINTER (1));
+ g_async_queue_push (q, GINT_TO_POINTER (2));
+ g_async_queue_push (q, GINT_TO_POINTER (3));
+ g_assert_cmpint (destroy_count, ==, 0);
+
+ g_async_queue_unref (q);
+ g_assert_cmpint (destroy_count, ==, 0);
+
+ item = g_async_queue_pop (q);
+ g_assert_cmpint (GPOINTER_TO_INT (item), ==, 1);
+ g_assert_cmpint (destroy_count, ==, 0);
+
+ g_async_queue_unref (q);
+ g_assert_cmpint (destroy_count, ==, 2);
+}
+
int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
+ g_test_add_func ("/asyncqueue/basics", test_basics);
g_test_add_func ("/asyncqueue/sort", test_async_queue_sort);
g_test_add_func ("/asyncqueue/destroy", test_async_queue_destroy);
g_test_add_func ("/asyncqueue/threads", test_async_queue_threads);
diff --git a/tests/meson.build b/tests/meson.build
index 1bb146afc..d1ebdb43f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -29,7 +29,6 @@ tests = {
'mainloop-test' : {},
'mapping-test' : {},
'onceinit' : {},
- 'asyncqueue-test' : {},
'relation-test' : {},
'slice-concurrent' : {},
'slice-threadinit' : {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]