dreid       01/05/13 10:55:43

  Modified:    test     test_apr.h
  Log:
  Some changes that Jeff suggested.  basically when we get an error we print
  the details on stderr, but otherwise we use stdout for messages.  This also
  changes the code to use apr_strerror which should be more portable and APR
  friendly :)
  
  Submitted by: Jeff Trawick
  Reviewed by:  David Reid
  
  Revision  Changes    Path
  1.4       +25 -19    apr/test/test_apr.h
  
  Index: test_apr.h
  ===================================================================
  RCS file: /home/cvs/apr/test/test_apr.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- test_apr.h        2001/05/13 15:34:17     1.3
  +++ test_apr.h        2001/05/13 17:55:43     1.4
  @@ -56,29 +56,35 @@
    * a bit more consistent...
    */
    
  -#include <string.h>
  +#include "apr_strings.h"
   
   #define TEST_EQ(str, func, value, good, bad) \
  -     printf("%-60s", str); \
  -     { apr_status_t rv; \
  -         if ((rv = func) == value){ \
  -             printf("%s\n", bad); \
  -            printf("Error was %d : %s\n", rv, strerror(rv)); \
  -             exit(-1); \
  -         } \
  -         printf("%s\n", good); \
  -     }
  +    printf("%-60s", str); \
  +    { \
  +    apr_status_t rv; \
  +    if ((rv = func) == value){ \
  +        char errmsg[200]; \
  +        printf("%s\n", bad); \
  +        fprintf(stderr, "Error was %d : %s\n", rv, \
  +                apr_strerror(rv, (char*)&errmsg, 200)); \
  +        exit(-1); \
  +    } \
  +    printf("%s\n", good); \
  +    }
   
   #define TEST_NEQ(str, func, value, good, bad) \
  -     printf("%-60s", str); \
  -     { apr_status_t rv; \
  -         if ((rv = func) != value){ \
  -             printf("%s\n", bad); \
  -            printf("Error was %d : %s\n", rv, strerror(rv)); \
  -             exit(-1); \
  -         } \
  -         printf("%s\n", good); \
  -     }
  +printf("%-60s", str); \
  +    { \
  +    apr_status_t rv; \
  +    if ((rv = func) != value){ \
  +        char errmsg[200]; \
  +        printf("%s\n", bad); \
  +        fprintf(stderr, "Error was %d : %s\n", rv, \
  +                apr_strerror(rv, (char*)&errmsg, 200)); \
  +        exit(-1); \
  +    } \
  +    printf("%s\n", good); \
  +    }
   
   #define STD_TEST_NEQ(str, func) \
        TEST_NEQ(str, func, APR_SUCCESS, "OK", "Failed");
  
  
  

Reply via email to