You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2004/07/17 04:55:06 UTC
[apreq-2] make/copy value tests
Here's some tests for apreq_(make|copy)_value - note that I
had to APREQ_DECLARE() apreq_copy_value() is src/apreq.[ch]
so that the this was available in the lib.
==================================================
Index: src/apreq.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
retrieving revision 1.43
diff -u -r1.43 apreq.c
--- src/apreq.c 17 Jul 2004 01:09:39 -0000 1.43
+++ src/apreq.c 17 Jul 2004 02:35:31 -0000
@@ -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)
Index: src/apreq.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.h,v
retrieving revision 1.47
diff -u -r1.47 apreq.h
--- src/apreq.h 10 Jul 2004 14:42:30 -0000 1.47
+++ src/apreq.h 17 Jul 2004 02:35:33 -0000
@@ -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.
Index: t/params.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/params.c,v
retrieving revision 1.14
diff -u -r1.14 params.c
--- t/params.c 17 Jul 2004 01:09:39 -0000 1.14
+++ t/params.c 17 Jul 2004 02:35:33 -0000
@@ -105,6 +105,24 @@
}
+static void make_values(CuTest *tc)
+{
+ apreq_value_t *v1, *v2;
+ char *name = apr_palloc(p,4096);
+ char *val = apr_palloc(p,4096);
+ strcpy(name, "foo");
+ strcpy(val, "bar");
+
+ v1 = apreq_make_value(p, name, 4, val, 4);
+ CuAssertStrEquals(tc, name, v1->name);
+ CuAssertIntEquals(tc, 4, v1->size);
+ CuAssertStrEquals(tc, val, v1->data);
+
+ v2 = apreq_copy_value(p, v1);
+ CuAssertStrEquals(tc, name, v2->name);
+ CuAssertIntEquals(tc, 4, v2->size);
+ CuAssertStrEquals(tc, val, v2->data);
+}
CuSuite *testparam(void)
{
@@ -115,6 +133,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;
}
Index: STATUS
===================================================================
RCS file: /home/cvs/httpd-apreq-2/STATUS,v
retrieving revision 1.69
diff -u -r1.69 STATUS
--- STATUS 17 Jul 2004 01:09:39 -0000 1.69
+++ STATUS 17 Jul 2004 02:35:33 -0000
@@ -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()
=====================================================
--
best regards,
randy
Re: [apreq-2] make/copy value tests
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
> Here's some tests for apreq_(make|copy)_value - note that I
> had to APREQ_DECLARE() apreq_copy_value() is src/apreq.[ch]
> so that the this was available in the lib.
+1.
--
Joe Schaefer