summaryrefslogtreecommitdiff
path: root/test/testatomic.c
diff options
context:
space:
mode:
authorGreg Ames <gregames@apache.org>2003-12-09 19:00:51 +0000
committerGreg Ames <gregames@apache.org>2003-12-09 19:00:51 +0000
commitc5592b29bf758bc5035c43c06c19f4b3679ae928 (patch)
treeed8121a92f3138fcd7ee390fbff6bbca18d60829 /test/testatomic.c
parentf22dfab641939380180e48a9bad4d67d97c569d1 (diff)
downloadapr-c5592b29bf758bc5035c43c06c19f4b3679ae928.tar.gz
add return value checks for apr_atomic_add32 and apr_atomic_inc32
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64827 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testatomic.c')
-rw-r--r--test/testatomic.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/testatomic.c b/test/testatomic.c
index aa8ccd9b2..74d9284f6 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -138,15 +138,35 @@ static apr_status_t check_basic_atomics32(void)
printf("%-60s", "testing apr_atomic_add32");
apr_atomic_set32(&y32, 23);
- apr_atomic_add32(&y32, 4);
+ if ((oldval = apr_atomic_add32(&y32, 4)) != 23) {
+ fprintf(stderr,
+ "Failed\noldval problem =%d should be 23\n",
+ oldval);
+ return APR_EGENERAL;
+ }
if ((oldval = apr_atomic_read32(&y32)) != 27) {
fprintf(stderr,
"Failed\nAtomic Add doesn't add up ;( expected 27 got %d\n",
oldval);
return APR_EGENERAL;
}
-
printf("OK\n");
+
+ printf("%-60s", "testing apr_atomic_inc32");
+ if ((oldval = apr_atomic_inc32(&y32)) != 27) {
+ fprintf(stderr,
+ "Failed\noldval problem =%d should be 27\n",
+ oldval);
+ return APR_EGENERAL;
+ }
+ if ((oldval = apr_atomic_read32(&y32)) != 28) {
+ fprintf(stderr,
+ "Failed\nAtomic Inc didn't increment ;( expected 28 got %d\n",
+ oldval);
+ return APR_EGENERAL;
+ }
+ printf("OK\n");
+
printf("%-60s", "testing add32/inc32/sub32");
apr_atomic_set32(&y32, 0);
apr_atomic_add32(&y32, 20);