From b006f9a9b04aff3e9bc16db4566e00f66f9ce328 Mon Sep 17 00:00:00 2001 From: trawick Date: Fri, 18 Apr 2003 18:10:01 +0000 Subject: we already verify that apr-determined format strings work fine with the system library; might as well check that they work with apr_snprintf too git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64487 13f79535-47bb-0310-9956-ffa450edef68 --- test/testfmt.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'test/testfmt.c') diff --git a/test/testfmt.c b/test/testfmt.c index 6f1d7f365..e1eb72e09 100644 --- a/test/testfmt.c +++ b/test/testfmt.c @@ -63,7 +63,9 @@ static void ssize_t_fmt(CuTest *tc) apr_ssize_t var = 0; sprintf(buf, "%" APR_SSIZE_T_FMT, var); - CuAssertStrEquals(tc, buf, "0"); + CuAssertStrEquals(tc, "0", buf); + apr_snprintf(buf, sizeof(buf), "%" APR_SSIZE_T_FMT, var); + CuAssertStrEquals(tc, "0", buf); } static void size_t_fmt(CuTest *tc) @@ -72,7 +74,9 @@ static void size_t_fmt(CuTest *tc) apr_size_t var = 0; sprintf(buf, "%" APR_SIZE_T_FMT, var); - CuAssertStrEquals(tc, buf, "0"); + CuAssertStrEquals(tc, "0", buf); + apr_snprintf(buf, sizeof(buf), "%" APR_SIZE_T_FMT, var); + CuAssertStrEquals(tc, "0", buf); } static void off_t_fmt(CuTest *tc) @@ -81,7 +85,9 @@ static void off_t_fmt(CuTest *tc) apr_off_t var = 0; sprintf(buf, "%" APR_OFF_T_FMT, var); - CuAssertStrEquals(tc, buf, "0"); + CuAssertStrEquals(tc, "0", buf); + apr_snprintf(buf, sizeof(buf), "%" APR_OFF_T_FMT, var); + CuAssertStrEquals(tc, "0", buf); } static void pid_t_fmt(CuTest *tc) @@ -90,7 +96,9 @@ static void pid_t_fmt(CuTest *tc) pid_t var = 0; sprintf(buf, "%" APR_PID_T_FMT, var); - CuAssertStrEquals(tc, buf, "0"); + CuAssertStrEquals(tc, "0", buf); + apr_snprintf(buf, sizeof(buf), "%" APR_PID_T_FMT, var); + CuAssertStrEquals(tc, "0", buf); } static void int64_t_fmt(CuTest *tc) @@ -99,7 +107,9 @@ static void int64_t_fmt(CuTest *tc) apr_int64_t var = 0; sprintf(buf, "%" APR_INT64_T_FMT, var); - CuAssertStrEquals(tc, buf, "0"); + CuAssertStrEquals(tc, "0", buf); + apr_snprintf(buf, sizeof(buf), "%" APR_INT64_T_FMT, var); + CuAssertStrEquals(tc, "0", buf); } static void uint64_t_fmt(CuTest *tc) @@ -108,7 +118,9 @@ static void uint64_t_fmt(CuTest *tc) apr_uint64_t var = 14000000; sprintf(buf, "%" APR_UINT64_T_FMT, var); - CuAssertStrEquals(tc, buf, "14000000"); + CuAssertStrEquals(tc, "14000000", buf); + apr_snprintf(buf, sizeof(buf), "%" APR_UINT64_T_FMT, var); + CuAssertStrEquals(tc, "14000000", buf); } static void uint64_t_hex_fmt(CuTest *tc) @@ -117,7 +129,9 @@ static void uint64_t_hex_fmt(CuTest *tc) apr_uint64_t var = 14000000; sprintf(buf, "%" APR_UINT64_T_HEX_FMT, var); - CuAssertStrEquals(tc, buf, "d59f80"); + CuAssertStrEquals(tc, "d59f80", buf); + apr_snprintf(buf, sizeof(buf), "%" APR_UINT64_T_HEX_FMT, var); + CuAssertStrEquals(tc, "d59f80", buf); } CuSuite *testfmt(void) -- cgit v1.2.1