apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: apr/test testatomic.c
Date Tue, 09 Dec 2003 19:00:51 GMT
gregames    2003/12/09 11:00:51

  Modified:    test     testatomic.c
  Log:
  add return value checks for apr_atomic_add32 and apr_atomic_inc32
  
  Revision  Changes    Path
  1.37      +22 -2     apr/test/testatomic.c
  
  Index: testatomic.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testatomic.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -d -b -u -r1.36 -r1.37
  --- testatomic.c	5 Dec 2003 16:53:12 -0000	1.36
  +++ testatomic.c	9 Dec 2003 19:00:51 -0000	1.37
  @@ -138,15 +138,35 @@
   
       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);
  
  
  

Mime
View raw message