apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: apr/test testtime.c
Date Thu, 28 Jun 2001 01:36:24 GMT
brane       01/06/27 18:36:24

  Modified:    test     testtime.c
  Log:
  Added explode/implode test for local time, and use APR's
  printf format defines.
  Also added a missing call to exit.
  
  Revision  Changes    Path
  1.21      +30 -8     apr/test/testtime.c
  
  Index: testtime.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testtime.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- testtime.c	2001/06/22 17:45:23	1.20
  +++ testtime.c	2001/06/28 01:36:22	1.21
  @@ -92,7 +92,7 @@
           exit(-1);
       }
       printf("OK\n");
  -    
  +
       printf("\tapr_explode_localtime...........................");
       if (apr_explode_localtime(&xt2, now) != APR_SUCCESS) {
           printf("Couldn't explode the time\n");
  @@ -110,14 +110,32 @@
       printf("\tchecking the explode/implode (GMT)..............");
       if (imp != now) {
   	printf("mismatch\n"
  -                "\tapr_now()                %lld\n"
  -                "\tapr_implode() returned   %lld\n"
  -                "\terror delta was          %lld\n",
  +                "\t\tapr_now()                %" APR_INT64_T_FMT "\n"
  +                "\t\tapr_implode() returned   %" APR_INT64_T_FMT "\n"
  +                "\t\terror delta was          %" APR_TIME_T_FMT "\n"
  +                "\t\tshould have been         0\n",
                   now, imp, imp-now);
   	exit(-1);
       }
       printf("OK\n");
   
  +    printf("\tchecking the explode/implode (local time).......");
  +    if (apr_implode_time(&imp, &xt2) != APR_SUCCESS) {
  +        printf("Couldn't implode the time\n");
  +        exit(-1);
  +    }
  +    hr_off_64 = (apr_int64_t)xt2.tm_gmtoff * APR_USEC_PER_SEC; /* microseconds */ 
  +    if (imp != now + hr_off_64) {
  +	printf("mismatch\n"
  +                "\t\tapr_now()                %" APR_INT64_T_FMT "\n"
  +                "\t\tapr_implode() returned   %" APR_INT64_T_FMT "\n"
  +                "\t\terror delta was          %" APR_TIME_T_FMT "\n"
  +                "\t\tshould have been         %" APR_INT64_T_FMT "\n",
  +                now, imp, imp-now, hr_off_64);
  +	exit(-1);
  +    }
  +    printf("OK\n");
  +
       str = apr_pcalloc(p, sizeof(char) * STR_SIZE);
       str2 = apr_pcalloc(p, sizeof(char) * STR_SIZE);
       imp = 0;
  @@ -171,7 +189,8 @@
   
       printf("\tComparing the created times.....................");
       if (! strcmp(str,str2)){
  -        printf("Failed\n");
  +        printf("Failed!\n");
  +        exit(-1);
       } else {
           printf("OK\n");
       }
  @@ -180,9 +199,12 @@
       apr_implode_time(&imp, &xt2);
       hr_off_64 = (apr_int64_t)hr_off * APR_USEC_PER_SEC; /* microseconds */ 
       if (imp != now + hr_off_64){
  -        printf("Failed! :(\n");
  -        printf("Difference is %" APR_TIME_T_FMT " (should be %" 
  -               APR_INT64_T_FMT ")\n", imp - now, hr_off_64);
  +	printf("mismatch\n"
  +                "\t\tapr_now()                %" APR_INT64_T_FMT "\n"
  +                "\t\tapr_implode() returned   %" APR_INT64_T_FMT "\n"
  +                "\t\terror delta was          %" APR_TIME_T_FMT "\n"
  +                "\t\tshould have been         %" APR_INT64_T_FMT "\n",
  +                now, imp, imp-now, hr_off_64);
           exit(-1);
       }
       printf("OK\n");
  
  
  

Mime
View raw message