about summary refs log tree commit diff
path: root/csu/tst-atomic.c
diff options
context:
space:
mode:
Diffstat (limited to 'csu/tst-atomic.c')
-rw-r--r--csu/tst-atomic.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/csu/tst-atomic.c b/csu/tst-atomic.c
index 727229eaf7..292f6e7334 100644
--- a/csu/tst-atomic.c
+++ b/csu/tst-atomic.c
@@ -99,7 +99,7 @@ do_test (void)
     }
 
   mem = 0;
-  if (! atomic_increment_and_test (&mem)
+  if (atomic_increment_and_test (&mem)
       || mem != 1)
     {
       puts ("atomic_increment_and_test test 1 failed");
@@ -114,6 +114,14 @@ do_test (void)
       ret = 1;
     }
 
+  mem = -1;
+  if (! atomic_increment_and_test (&mem)
+      || mem != 0)
+    {
+      puts ("atomic_increment_and_test test 3 failed");
+      ret = 1;
+    }
+
   mem = 17;
   atomic_decrement (&mem);
   if (mem != 16)
@@ -123,7 +131,7 @@ do_test (void)
     }
 
   mem = 0;
-  if (! atomic_decrement_and_test (&mem)
+  if (atomic_decrement_and_test (&mem)
       || mem != -1)
     {
       puts ("atomic_decrement_and_test test 1 failed");
@@ -139,6 +147,14 @@ do_test (void)
     }
 
   mem = 1;
+  if (! atomic_decrement_and_test (&mem)
+      || mem != 0)
+    {
+      puts ("atomic_decrement_and_test test 1 failed");
+      ret = 1;
+    }
+
+  mem = 1;
   if (atomic_decrement_if_positive (&mem) != 1
       || mem != 0)
     {