rbb 2002/10/23 17:20:33
Modified: test Makefile.in test_apr.h testall.c testfmt.c
Log:
Port testfmt to the new test suite.
Revision Changes Path
1.100 +2 -6 apr/test/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apr/test/Makefile.in,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- Makefile.in 24 Oct 2002 00:12:24 -0000 1.99
+++ Makefile.in 24 Oct 2002 00:20:33 -0000 1.100
@@ -14,7 +14,6 @@
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@ \
- [EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@ \
[EMAIL PROTECTED]@ \
@@ -75,9 +74,6 @@
[EMAIL PROTECTED]@: testflock.lo $(LOCAL_LIBS)
$(LINK) testflock.lo $(LOCAL_LIBS) $(ALL_LIBS)
[EMAIL PROTECTED]@: testfmt.lo $(LOCAL_LIBS)
- $(LINK) testfmt.lo $(LOCAL_LIBS) $(ALL_LIBS)
-
[EMAIL PROTECTED]@: testdso.lo mod_test.la libmod_test.la $(LOCAL_LIBS)
$(LINK) testdso.lo $(LOCAL_LIBS) $(ALL_LIBS)
@@ -169,8 +165,8 @@
[EMAIL PROTECTED]@: testmutexscope.lo $(LOCAL_LIBS)
$(LINK) testmutexscope.lo $(LOCAL_LIBS) $(ALL_LIBS)
-testall: testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo
testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo CuTest.lo
$(LOCAL_LIBS)
- $(LINK) testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo
testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo CuTest.lo
$(LOCAL_LIBS) $(ALL_LIBS)
+testall: testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo
testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo testfmt.lo
CuTest.lo $(LOCAL_LIBS)
+ $(LINK) testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo
testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo testfmt.lo
CuTest.lo $(LOCAL_LIBS) $(ALL_LIBS)
# DO NOT REMOVE
1.18 +1 -0 apr/test/test_apr.h
Index: test_apr.h
===================================================================
RCS file: /home/cvs/apr/test/test_apr.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- test_apr.h 22 Oct 2002 23:22:06 -0000 1.17
+++ test_apr.h 24 Oct 2002 00:20:33 -0000 1.18
@@ -75,6 +75,7 @@
CuSuite *testtable(void);
CuSuite *testsleep(void);
CuSuite *testpool(void);
+CuSuite *testfmt(void);
1.11 +1 -0 apr/test/testall.c
Index: testall.c
===================================================================
RCS file: /home/cvs/apr/test/testall.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- testall.c 23 Oct 2002 23:28:12 -0000 1.10
+++ testall.c 24 Oct 2002 00:20:33 -0000 1.11
@@ -73,6 +73,7 @@
testtable,
testsleep,
testpool,
+ testfmt,
NULL
};
1.5 +64 -30 apr/test/testfmt.c
Index: testfmt.c
===================================================================
RCS file: /home/cvs/apr/test/testfmt.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- testfmt.c 16 Mar 2002 18:42:00 -0000 1.4
+++ testfmt.c 24 Oct 2002 00:20:33 -0000 1.5
@@ -52,39 +52,73 @@
* <http://www.apache.org/>.
*/
-#include <stdio.h>
-
+#include "test_apr.h"
#include "apr.h"
#include "apr_portable.h"
-int main(int argc, char *argv[])
+
+static void ssize_t_fmt(CuTest *tc)
+{
+ char buf[100];
+ apr_ssize_t var = 0;
+
+ sprintf(buf, "%" APR_SSIZE_T_FMT, var);
+ CuAssertStrEquals(tc, buf, "0");
+}
+
+static void size_t_fmt(CuTest *tc)
+{
+ char buf[100];
+ apr_size_t var = 0;
+
+ sprintf(buf, "%" APR_SIZE_T_FMT, var);
+ CuAssertStrEquals(tc, buf, "0");
+}
+
+static void off_t_fmt(CuTest *tc)
+{
+ char buf[100];
+ apr_off_t var = 0;
+
+ sprintf(buf, "%" APR_OFF_T_FMT, var);
+ CuAssertStrEquals(tc, buf, "0");
+}
+
+static void pid_t_fmt(CuTest *tc)
+{
+ char buf[100];
+ pid_t var = 0;
+
+ sprintf(buf, "%" APR_PID_T_FMT, var);
+ CuAssertStrEquals(tc, buf, "0");
+}
+
+static void int64_t_fmt(CuTest *tc)
{
char buf[100];
-
- {
- apr_ssize_t var = 0;
- sprintf(buf, "%" APR_SSIZE_T_FMT, var);
- }
-
- {
- apr_size_t var = 0;
- sprintf(buf, "%" APR_SIZE_T_FMT, var);
- }
-
- {
- apr_off_t var = 0;
- sprintf(buf, "%" APR_OFF_T_FMT, var);
- }
-
- {
- pid_t var = 0;
- sprintf(buf, "%" APR_PID_T_FMT, var);
- }
-
- {
- apr_int64_t var = 0;
- sprintf(buf, "%" APR_INT64_T_FMT, var);
- }
-
- return 0;
+ apr_int64_t var = 0;
+
+ sprintf(buf, "%" APR_INT64_T_FMT, var);
+ CuAssertStrEquals(tc, buf, "0");
+}
+
+CuSuite *testfmt(void)
+{
+ CuSuite *suite = CuSuiteNew("Test Formats");
+
+ SUITE_ADD_TEST(suite, ssize_t_fmt);
+ SUITE_ADD_TEST(suite, size_t_fmt);
+ SUITE_ADD_TEST(suite, off_t_fmt);
+ SUITE_ADD_TEST(suite, pid_t_fmt);
+ SUITE_ADD_TEST(suite, int64_t_fmt);
+
+ return suite;
}
+
+#ifdef SINGLE_PROG
+CuSuite *getsuite(void)
+{
+ return testfmt();
+}
+#endif
+