From: <nul...@cl...> - 2011-11-25 13:02:14
|
Kouhei Sutou 2011-11-25 13:01:28 +0000 (Fri, 25 Nov 2011) New Revision: b5a53811d21e6d189bde93482d52707249ae7580 Log: [sample][glib] remove an unmaintable test. Removed files: sample/glib/atomic.c Modified files: sample/glib/Makefile.am Modified: sample/glib/Makefile.am (+0 -2) =================================================================== --- sample/glib/Makefile.am 2011-11-24 10:42:37 +0000 (0990a3d) +++ sample/glib/Makefile.am 2011-11-25 13:01:28 +0000 (98957fb) @@ -17,7 +17,6 @@ TESTS_ENVIRONMENT = NO_MAKE=yes noinst_LTLIBRARIES = \ test_array.la \ - test_atomic.la \ test_base64.la \ test_iochannel.la \ test_keyfile.la \ @@ -43,7 +42,6 @@ LIBS = \ $(GLIB_LIBS) test_array_la_SOURCES = array.c -test_atomic_la_SOURCES = atomic.c test_base64_la_SOURCES = base64.c test_iochannel_la_SOURCES = iochannel.c test_keyfile_la_SOURCES = keyfile.c Deleted: sample/glib/atomic.c (+0 -60) 100644 =================================================================== --- sample/glib/atomic.c 2011-11-24 10:42:37 +0000 (3104391) +++ /dev/null @@ -1,60 +0,0 @@ -#include <cutter.h> -#include <glib.h> - -void test_atomic (void); - -/* Obviously we can't test that the operations are atomic, but we can - * at least test, that they do, what they ought to do */ - -void -test_atomic (void) -{ - 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); - cut_assert_equal_int (10, atomic); - for (i = 0; i < 9; i++) - cut_assert (!g_atomic_int_dec_and_test (&atomic)); - cut_assert (g_atomic_int_dec_and_test (&atomic)); - cut_assert_equal_int (0, atomic); - - cut_assert_equal_int (0, g_atomic_int_exchange_and_add (&atomic, 5)); - cut_assert_equal_int (5, atomic); - - cut_assert_equal_int (5, g_atomic_int_exchange_and_add (&atomic, -10)); - cut_assert_equal_int (-5, atomic); - - g_atomic_int_add (&atomic, 20); - cut_assert_equal_int (15, atomic); - - g_atomic_int_add (&atomic, -35); - cut_assert_equal_int (-20, atomic); - - cut_assert_equal_int (atomic, g_atomic_int_get (&atomic)); - - cut_assert (g_atomic_int_compare_and_exchange (&atomic, -20, 20)); - cut_assert_equal_int (20, atomic); - - cut_assert (!g_atomic_int_compare_and_exchange (&atomic, 42, 12)); - cut_assert_equal_int (20, atomic); - - cut_assert (g_atomic_int_compare_and_exchange (&atomic, 20, G_MAXINT)); - cut_assert_equal_int (G_MAXINT, atomic); - - cut_assert (g_atomic_int_compare_and_exchange (&atomic, G_MAXINT, G_MININT)); - cut_assert_equal_int (G_MININT, atomic); - - cut_assert (g_atomic_pointer_compare_and_exchange (&atomic_pointer, - NULL, biggest_pointer)); - cut_assert_equal_pointer (biggest_pointer, atomic_pointer); - - cut_assert_equal_pointer (atomic_pointer, g_atomic_pointer_get (&atomic_pointer)); - - cut_assert (g_atomic_pointer_compare_and_exchange (&atomic_pointer, - biggest_pointer, NULL)); - cut_assert (biggest_pointer); -} |