apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1545279 - /apr/apr/trunk/test/testatomic.c
Date Mon, 25 Nov 2013 13:44:52 GMT
Author: jim
Date: Mon Nov 25 13:44:52 2013
New Revision: 1545279

URL: http://svn.apache.org/r1545279
Log:
Test that adding a negative number works as expected

Modified:
    apr/apr/trunk/test/testatomic.c

Modified: apr/apr/trunk/test/testatomic.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testatomic.c?rev=1545279&r1=1545278&r2=1545279&view=diff
==============================================================================
--- apr/apr/trunk/test/testatomic.c (original)
+++ apr/apr/trunk/test/testatomic.c Mon Nov 25 13:44:52 2013
@@ -167,6 +167,17 @@ static void test_add32(abts_case *tc, vo
     ABTS_INT_EQUAL(tc, 27, y32);
 }
 
+static void test_add32_neg(abts_case *tc, void *data)
+{
+    apr_uint32_t oldval;
+    apr_uint32_t y32;
+
+    apr_atomic_set32(&y32, 23);
+    oldval = apr_atomic_add32(&y32, -10);
+    ABTS_INT_EQUAL(tc, 23, oldval);
+    ABTS_INT_EQUAL(tc, 13, y32);
+}
+
 static void test_inc32(abts_case *tc, void *data)
 {
     apr_uint32_t oldval;
@@ -509,6 +520,7 @@ abts_suite *testatomic(abts_suite *suite
     abts_run_test(suite, test_casptr_equal_nonnull, NULL);
     abts_run_test(suite, test_casptr_notequal, NULL);
     abts_run_test(suite, test_add32, NULL);
+    abts_run_test(suite, test_add32_neg, NULL);
     abts_run_test(suite, test_inc32, NULL);
     abts_run_test(suite, test_set_add_inc_sub, NULL);
     abts_run_test(suite, test_wrap_zero, NULL);



Mime
View raw message