randyk 2004/07/17 10:05:27
Modified: . STATUS
src apreq.c apreq.h
t params.c
Log:
Reviewed by: joes
add tests for apreq_(make|copy)_value, and declare apreq_copy_value
using APREQ_DECLARE().
Revision Changes Path
1.70 +1 -3 httpd-apreq-2/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/httpd-apreq-2/STATUS,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- STATUS 17 Jul 2004 01:09:39 -0000 1.69
+++ STATUS 17 Jul 2004 17:05:27 -0000 1.70
@@ -60,8 +60,6 @@
- The current tests don't cover these functions,
so add CuTest tests for them:
- - apreq_make_value()
- - apreq_copy_value()
- apreq_merge_values()
- apreq_enctype()
- apreq_memmem()
1.44 +2 -2 httpd-apreq-2/src/apreq.c
Index: apreq.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- apreq.c 17 Jul 2004 01:09:39 -0000 1.43
+++ apreq.c 17 Jul 2004 17:05:27 -0000 1.44
@@ -45,8 +45,8 @@
}
-apreq_value_t * apreq_copy_value(apr_pool_t *p,
- const apreq_value_t *val)
+APREQ_DECLARE(apreq_value_t *)apreq_copy_value(apr_pool_t *p,
+ const apreq_value_t *val)
{
apreq_value_t *v;
if (val == NULL)
1.48 +2 -2 httpd-apreq-2/src/apreq.h
Index: apreq.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- apreq.h 10 Jul 2004 14:42:30 -0000 1.47
+++ apreq.h 17 Jul 2004 17:05:27 -0000 1.48
@@ -121,8 +121,8 @@
* @param p Pool.
* @param val Original value to copy.
*/
-apreq_value_t * apreq_copy_value(apr_pool_t *p,
- const apreq_value_t *val);
+APREQ_DECLARE(apreq_value_t *) apreq_copy_value(apr_pool_t *p,
+ const apreq_value_t *val);
/**
* Merges an array of values into one.
1.15 +20 -0 httpd-apreq-2/t/params.c
Index: params.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/params.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- params.c 17 Jul 2004 01:09:39 -0000 1.14
+++ params.c 17 Jul 2004 17:05:27 -0000 1.15
@@ -105,6 +105,25 @@
}
+static void make_values(CuTest *tc)
+{
+ apreq_value_t *v1, *v2;
+ apr_size_t len = 4;
+ char *name = apr_palloc(p,len);
+ char *val = apr_palloc(p,len);
+ strcpy(name, "foo");
+ strcpy(val, "bar");
+
+ v1 = apreq_make_value(p, name, len, val, len);
+ CuAssertStrEquals(tc, name, v1->name);
+ CuAssertIntEquals(tc, len, v1->size);
+ CuAssertStrEquals(tc, val, v1->data);
+
+ v2 = apreq_copy_value(p, v1);
+ CuAssertStrEquals(tc, name, v2->name);
+ CuAssertIntEquals(tc, len, v2->size);
+ CuAssertStrEquals(tc, val, v2->data);
+}
CuSuite *testparam(void)
{
@@ -115,6 +134,7 @@
SUITE_ADD_TEST(suite, params_as);
SUITE_ADD_TEST(suite, string_decoding_in_place);
SUITE_ADD_TEST(suite, header_attributes);
+ SUITE_ADD_TEST(suite, make_values);
return suite;
}