summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2019-10-08 12:08:50 +0100
committerPhilip Withnall <withnall@endlessm.com>2019-10-08 12:10:20 +0100
commit30dd30d05a6e20589a52a6e32d9bf8610548be95 (patch)
treef0c43a2fc106bcab233a6128a416efe6005d2442
parent5dbaa18d6117a301e7b08da69af2c90ab9024657 (diff)
downloadglib-30dd30d05a6e20589a52a6e32d9bf8610548be95.tar.gz
tests: Remove redundant old atomic test
The test in `glib/tests/atomic.c` does everything this test did, and more. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1434
-rw-r--r--tests/atomic-test.c63
-rw-r--r--tests/meson.build1
2 files changed, 0 insertions, 64 deletions
diff --git a/tests/atomic-test.c b/tests/atomic-test.c
deleted file mode 100644
index 3dd4b1990..000000000
--- a/tests/atomic-test.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#undef G_DISABLE_ASSERT
-#undef G_LOG_DOMAIN
-
-#include <glib.h>
-
-/* Obviously we can't test that the operations are atomic, but we can
- * at least test, that they do, what they ought to do */
-
-int
-main (int argc,
- char *argv[])
-{
- gint i;
- gint atomic = -5;
- gpointer atomic_pointer = NULL;
- gpointer biggest_pointer = (gpointer)((gsize)atomic_pointer - 1);
-
- for (i = 0; i < 15; i++)
- g_atomic_int_inc (&atomic);
- g_assert (atomic == 10);
- for (i = 0; i < 9; i++)
- g_assert (!g_atomic_int_dec_and_test (&atomic));
- g_assert (g_atomic_int_dec_and_test (&atomic));
- g_assert (atomic == 0);
-
- g_assert (g_atomic_int_add (&atomic, 5) == 0);
- g_assert (atomic == 5);
-
- g_assert (g_atomic_int_add (&atomic, -10) == 5);
- g_assert (atomic == -5);
-
- g_atomic_int_add (&atomic, 20);
- g_assert (atomic == 15);
-
- g_atomic_int_add (&atomic, -35);
- g_assert (atomic == -20);
-
- g_assert (atomic == g_atomic_int_get (&atomic));
-
- g_assert (g_atomic_int_compare_and_exchange (&atomic, -20, 20));
- g_assert (atomic == 20);
-
- g_assert (!g_atomic_int_compare_and_exchange (&atomic, 42, 12));
- g_assert (atomic == 20);
-
- g_assert (g_atomic_int_compare_and_exchange (&atomic, 20, G_MAXINT));
- g_assert (atomic == G_MAXINT);
-
- g_assert (g_atomic_int_compare_and_exchange (&atomic, G_MAXINT, G_MININT));
- g_assert (atomic == G_MININT);
-
- g_assert (g_atomic_pointer_compare_and_exchange (&atomic_pointer,
- NULL, biggest_pointer));
- g_assert (atomic_pointer == biggest_pointer);
-
- g_assert (atomic_pointer == g_atomic_pointer_get (&atomic_pointer));
-
- g_assert (g_atomic_pointer_compare_and_exchange (&atomic_pointer,
- biggest_pointer, NULL));
- g_assert (atomic_pointer == NULL);
-
- return 0;
-}
diff --git a/tests/meson.build b/tests/meson.build
index e4ea22692..6741f8f52 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -19,7 +19,6 @@ tests = {
'testglib' : {'tap' : true},
'testgdate' : {},
'datetime' : {},
- 'atomic-test' : {},
'bit-test' : {},
'child-test' : {},
'completion-test' : {},