apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/test testfmt.c teststr.c
Date Mon, 17 Nov 2003 12:15:12 GMT
jorton      2003/11/17 04:15:12

  Modified:    test     testfmt.c teststr.c
  Log:
  * test/teststr.c (snprintf_int64): Moved from here...
  
  * test/testfmt.c (more_int64_fmts): ...to here, and adjusted to use
  APR_UINT64_C() now it is available.
  
  Revision  Changes    Path
  1.12      +20 -2     apr/test/testfmt.c
  
  Index: testfmt.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfmt.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -u -r1.11 -r1.12
  --- testfmt.c	27 Apr 2003 15:40:16 -0000	1.11
  +++ testfmt.c	17 Nov 2003 12:15:12 -0000	1.12
  @@ -115,7 +115,7 @@
   static void uint64_t_fmt(CuTest *tc)
   {
       char buf[100];
  -    apr_uint64_t var = 14000000;
  +    apr_uint64_t var = APR_UINT64_C(14000000);
   
       sprintf(buf, "%" APR_UINT64_T_FMT, var);
       CuAssertStrEquals(tc, "14000000", buf);
  @@ -126,7 +126,7 @@
   static void uint64_t_hex_fmt(CuTest *tc)
   {
       char buf[100];
  -    apr_uint64_t var = 14000000;
  +    apr_uint64_t var = APR_UINT64_C(14000000);
   
       sprintf(buf, "%" APR_UINT64_T_HEX_FMT, var);
       CuAssertStrEquals(tc, "d59f80", buf);
  @@ -134,6 +134,23 @@
       CuAssertStrEquals(tc, "d59f80", buf);
   }
   
  +static void more_int64_fmts(CuTest *tc)
  +{
  +    char buf[100];
  +    apr_int64_t i = APR_INT64_C(-42);
  +    apr_uint64_t ui = APR_UINT64_C(42);
  +    apr_uint64_t big = APR_UINT64_C(3141592653589793238);
  +
  +    apr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, i);
  +    CuAssertStrEquals(tc, buf, "-42");
  +
  +    apr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, ui);
  +    CuAssertStrEquals(tc, buf, "42");
  +
  +    apr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, big);
  +    CuAssertStrEquals(tc, buf, "3141592653589793238");
  +}
  +
   CuSuite *testfmt(void)
   {
       CuSuite *suite = CuSuiteNew("Formats");
  @@ -145,6 +162,7 @@
       SUITE_ADD_TEST(suite, int64_t_fmt);
       SUITE_ADD_TEST(suite, uint64_t_fmt);
       SUITE_ADD_TEST(suite, uint64_t_hex_fmt);
  +    SUITE_ADD_TEST(suite, more_int64_fmts);
   
       return suite;
   }
  
  
  
  1.17      +0 -18     apr/test/teststr.c
  
  Index: teststr.c
  ===================================================================
  RCS file: /home/cvs/apr/test/teststr.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -u -r1.16 -r1.17
  --- teststr.c	28 May 2003 04:39:42 -0000	1.16
  +++ teststr.c	17 Nov 2003 12:15:12 -0000	1.17
  @@ -164,23 +164,6 @@
       CuAssert(tc, "buff unmangled", strcmp(buff, "FOOBAR") != 0);
   }
   
  -static void snprintf_int64(CuTest *tc)
  -{
  -    char buf[100];
  -    apr_int64_t i = APR_INT64_C(-42);
  -    apr_uint64_t ui = APR_INT64_C(42); /* no APR_UINT64_C */
  -    apr_uint64_t big = APR_INT64_C(3141592653589793238);
  -
  -    apr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, i);
  -    CuAssertStrEquals(tc, buf, "-42");
  -
  -    apr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, ui);
  -    CuAssertStrEquals(tc, buf, "42");
  -
  -    apr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, big);
  -    CuAssertStrEquals(tc, buf, "3141592653589793238");
  -}
  -
   static void string_error(CuTest *tc)
   {
        char buf[128], *rv;
  @@ -213,7 +196,6 @@
       SUITE_ADD_TEST(suite, snprintf_0NULL);
       SUITE_ADD_TEST(suite, snprintf_0nonNULL);
       SUITE_ADD_TEST(suite, snprintf_noNULL);
  -    SUITE_ADD_TEST(suite, snprintf_int64);
       SUITE_ADD_TEST(suite, test_strtok);
       SUITE_ADD_TEST(suite, string_error);
       SUITE_ADD_TEST(suite, string_long);
  
  
  

Mime
View raw message