diff options
author | Paul Querna <pquerna@apache.org> | 2007-05-16 00:17:03 +0000 |
---|---|---|
committer | Paul Querna <pquerna@apache.org> | 2007-05-16 00:17:03 +0000 |
commit | 8dfc7444c4a80b47f16d41ad46478192787206a6 (patch) | |
tree | c26f0822cf1edc4a52cabcc8e8ee0178d3f2bfc1 /test/testtable.c | |
parent | 3b8d0ab45411ac1cb2d76cb3e989744a2dc488da (diff) | |
download | apr-8dfc7444c4a80b47f16d41ad46478192787206a6.tar.gz |
Add apr_array_clear() API.
* include/apr_tables.h
* tables/apr_tables.c
(apr_array_clear): Declare and define new API.
* test/testtable.c
(a1): Static variable for use across array tests.
(array_clear): New test for apr_array_clear().
(testtable): Add array_clear() to the test suite.
Submitted By: Daniel Rall <dlr apache.org>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@538391 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testtable.c')
-rw-r--r-- | test/testtable.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/testtable.c b/test/testtable.c index d377eaf5a..90dc8d2ed 100644 --- a/test/testtable.c +++ b/test/testtable.c @@ -30,8 +30,18 @@ #include <string.h> #endif +static apr_array_header_t *a1 = NULL; static apr_table_t *t1 = NULL; +static void array_clear(abts_case *tc, void *data) +{ + a1 = apr_array_make(p, 2, sizeof(const char *)); + APR_ARRAY_PUSH(a1, const char *) = "foo"; + APR_ARRAY_PUSH(a1, const char *) = "bar"; + apr_array_clear(a1); + ABTS_INT_EQUAL(tc, 0, a1->nelts); +} + static void table_make(abts_case *tc, void *data) { t1 = apr_table_make(p, 5); @@ -174,6 +184,7 @@ abts_suite *testtable(abts_suite *suite) { suite = ADD_SUITE(suite) + abts_run_test(suite, array_clear, NULL); abts_run_test(suite, table_make, NULL); abts_run_test(suite, table_get, NULL); abts_run_test(suite, table_set, NULL); |