joes 2003/05/20 13:27:34
Modified: t Makefile.am cookie.c env.c params.c parsers.c
performance.c tables.c test_apreq.h
Log:
s/apreq_table/apr_table/g, phase 2: update library tests to reflect changes
in core
Revision Changes Path
1.8 +2 -2 httpd-apreq-2/t/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile.am 3 May 2003 05:22:33 -0000 1.7
+++ Makefile.am 20 May 2003 20:27:32 -0000 1.8
@@ -7,7 +7,7 @@
check_PROGRAMS = testall
testall_LDADD = libapreq_tests.a
-testall_LINK = @APACHE2_APXS@ -c -p -l apreq -o testall
+testall_LINK = @APACHE2_APXS@ -c -p -lapreq -o testall
test: check
- ./testall
\ No newline at end of file
+ ./testall -v
1.4 +9 -9 httpd-apreq-2/t/cookie.c
Index: cookie.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/cookie.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cookie.c 3 May 2003 05:22:33 -0000 1.3
+++ cookie.c 20 May 2003 20:27:32 -0000 1.4
@@ -71,22 +71,22 @@
{
const char *val;
- val = apreq_table_get(j->cookies,"a");
+ val = apr_table_get(j->cookies,"a");
CuAssertStrEquals(tc,"1",val);
- val = apreq_table_get(j->cookies,"b");
+ val = apr_table_get(j->cookies,"b");
CuAssertStrEquals(tc,"2",val);
- val = apreq_table_get(j->cookies,"foo");
+ val = apr_table_get(j->cookies,"foo");
CuAssertStrEquals(tc,"bar",val);
- val = apreq_table_get(j->cookies,"fl");
+ val = apr_table_get(j->cookies,"fl");
CuAssertStrEquals(tc,"left",val);
- val = apreq_table_get(j->cookies,"fr");
+ val = apr_table_get(j->cookies,"fr");
CuAssertStrEquals(tc,"right",val);
- val = apreq_table_get(j->cookies,"frl");
+ val = apr_table_get(j->cookies,"frl");
CuAssertStrEquals(tc,"right-left",val);
- val = apreq_table_get(j->cookies,"flr");
+ val = apr_table_get(j->cookies,"flr");
CuAssertStrEquals(tc,"left-right",val);
- val = apreq_table_get(j->cookies,"fll");
+ val = apr_table_get(j->cookies,"fll");
CuAssertStrEquals(tc,"left-left",val);
}
@@ -119,7 +119,7 @@
{
apreq_cookie_t *c = apreq_make_cookie(p,RFC,"rfc",3,"out",3);
apreq_cookie_version_t version = RFC;
- long expires = apreq_atol("+3m");
+ long expires = apreq_atoi64t("+3m");
CuAssertStrEquals(tc,"out",apreq_cookie_value(c));
CuAssertIntEquals(tc, version,c->version);
1.8 +3 -3 httpd-apreq-2/t/env.c
Index: env.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/env.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- env.c 6 May 2003 02:11:37 -0000 1.7
+++ env.c 20 May 2003 20:27:32 -0000 1.8
@@ -69,7 +69,7 @@
#define CRLF "\015\012"
apr_bucket_brigade *bb;
-apreq_table_t *table;
+apr_table_t *table;
APREQ_DECLARE(apr_pool_t *)apreq_env_pool(void *env)
{
@@ -88,9 +88,9 @@
return printf("%s: %s" CRLF, name, value) > 0 ? APR_SUCCESS :
APR_EGENERAL;
}
-APREQ_DECLARE(const char *)apreq_env_args(void *env)
+APREQ_DECLARE(const char *)apreq_env_query_string(void *env)
{
- return NULL;
+ return env;
}
APREQ_DECLARE(apreq_jar_t *)apreq_env_jar(void *env, apreq_jar_t *jar)
1.4 +9 -8 httpd-apreq-2/t/params.c
Index: params.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/params.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- params.c 23 Apr 2003 22:57:57 -0000 1.3
+++ params.c 20 May 2003 20:27:32 -0000 1.4
@@ -58,33 +58,34 @@
#include "apreq_params.h"
#include "apr_strings.h"
+
static apreq_request_t *r = NULL;
static void request_make(CuTest *tc)
{
r =
apreq_request(NULL,"a=1;quux=foo+bar&plus=%2B;uplus=%U002b;okie=dokie;novalue1;novalue2=");
CuAssertPtrNotNull(tc, r);
- CuAssertIntEquals(tc,7, apreq_table_nelts(r->args));
+ CuAssertIntEquals(tc,7, apr_table_nelts(r->args));
}
static void request_args_get(CuTest *tc)
{
const char *val;
- val = apreq_table_get(r->args,"a");
+ val = apr_table_get(r->args,"a");
CuAssertStrEquals(tc,"1",val);
- val = apreq_table_get(r->args,"quux");
+ val = apr_table_get(r->args,"quux");
CuAssertStrEquals(tc,"foo bar",val);
- val = apreq_table_get(r->args,"plus");
+ val = apr_table_get(r->args,"plus");
CuAssertStrEquals(tc,"+",val);
- val = apreq_table_get(r->args,"uplus");
+ val = apr_table_get(r->args,"uplus");
CuAssertStrEquals(tc,"+",val);
- val = apreq_table_get(r->args,"okie");
+ val = apr_table_get(r->args,"okie");
CuAssertStrEquals(tc,"dokie",val);
- val = apreq_table_get(r->args,"novalue1");
+ val = apr_table_get(r->args,"novalue1");
CuAssertStrEquals(tc,"",val);
- val = apreq_table_get(r->args,"novalue2");
+ val = apr_table_get(r->args,"novalue2");
CuAssertStrEquals(tc,"",val);
}
1.4 +10 -10 httpd-apreq-2/t/parsers.c
Index: parsers.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/parsers.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- parsers.c 6 May 2003 02:11:37 -0000 1.3
+++ parsers.c 20 May 2003 20:27:32 -0000 1.4
@@ -75,7 +75,7 @@
"--AaB03x--" CRLF;
extern apr_bucket_brigade *bb;
-extern apreq_table_t *table;
+extern apr_table_t *table;
extern apreq_cfg_t *config;
static void parse_urlencoded(CuTest *tc)
@@ -98,12 +98,12 @@
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- val = apreq_table_get(req->body,"alpha");
+ val = apr_table_get(req->body,"alpha");
CuAssertStrEquals(tc, "one", val);
- val = apreq_table_get(req->body,"beta");
+ val = apr_table_get(req->body,"beta");
CuAssertStrEquals(tc, "two", val);
- val = apreq_table_get(req->body,"omega");
+ val = apr_table_get(req->body,"omega");
CuAssertStrEquals(tc, "last", val);
}
@@ -112,7 +112,7 @@
{
const char *val;
apr_size_t dummy;
- apreq_table_t *t;
+ apr_table_t *t;
apr_status_t rv;
apreq_request_t *req = apreq_request(APREQ_MFD_ENCTYPE
"; boundary=\"AaB03x\"" ,"");
@@ -133,21 +133,21 @@
CuAssertIntEquals(tc, APR_SUCCESS, rv);
CuAssertPtrNotNull(tc, req->body);
- CuAssertIntEquals(tc, 2, apreq_table_nelts(req->body));
+ CuAssertIntEquals(tc, 2, apr_table_nelts(req->body));
return;
- val = apreq_table_get(req->body,"field1");
+ val = apr_table_get(req->body,"field1");
CuAssertStrEquals(tc, "Joe owes =80100.", val);
t = apreq_value_to_param(apreq_strtoval(val))->info;
- val = apreq_table_get(t, "content-transfer-encoding");
+ val = apr_table_get(t, "content-transfer-encoding");
CuAssertStrEquals(tc,"quoted-printable", val);
- val = apreq_table_get(req->body, "pics");
+ val = apr_table_get(req->body, "pics");
CuAssertStrEquals(tc, "file1.txt", val);
t = apreq_value_to_param(apreq_strtoval(val))->info;
bb = apreq_value_to_param(apreq_strtoval(val))->bb;
apr_brigade_pflatten(bb, (char **)&val, &dummy, p);
CuAssertStrEquals(tc,"... contents of file1.txt ...", val);
- val = apreq_table_get(t, "content-type");
+ val = apr_table_get(t, "content-type");
CuAssertStrEquals(tc, "text/plain", val);
}
1.3 +10 -8 httpd-apreq-2/t/performance.c
Index: performance.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/performance.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- performance.c 6 May 2003 02:11:37 -0000 1.2
+++ performance.c 20 May 2003 20:27:32 -0000 1.3
@@ -118,7 +118,7 @@
VV(Connection), VV(Referer), VV(Cookie),
VV(Content-Type), VV(Content-Length) };
for (j = 0; j < 12; ++j)
- apreq_table_add(t,v + j);
+ apreq_table_addv(t,v + j);
return t;
}
@@ -159,6 +159,15 @@
apr_time_t apreq_delta,apr_delta;
int i;
+ apr_delta = apr_time_now();
+ for (i=0; i<LOOP;++i) {
+ apr_table_t *s = init_apr(NELTS);
+/* apr_table_t *t = apr_table_make(p,NELTS);
+// apr_table_overlap(t,s,APR_OVERLAP_TABLES_MERGE);
+*/ apr_table_compress(s);
+ }
+ apr_delta = apr_time_now() - apr_delta;
+
apreq_delta = apr_time_now();
for (i=0; i<LOOP;++i) {
apreq_table_t *t = init_apreq(NELTS);
@@ -166,13 +175,6 @@
}
apreq_delta = apr_time_now() - apreq_delta;
- apr_delta = apr_time_now();
- for (i=0; i<LOOP;++i) {
- apr_table_t *t = apr_table_make(p,NELTS);
- apr_table_t *s = init_apr(NELTS*2);
- apr_table_overlap(t,s,APR_OVERLAP_TABLES_MERGE);
- }
- apr_delta = apr_time_now() - apr_delta;
TEST_DELTAS(apreq,apr,"apreq should win");
1.10 +33 -33 httpd-apreq-2/t/tables.c
Index: tables.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/tables.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- tables.c 3 May 2003 05:22:33 -0000 1.9
+++ tables.c 20 May 2003 20:27:32 -0000 1.10
@@ -113,15 +113,15 @@
{
const char *val;
- apreq_table_add(t1, V("add", "bar"));
- apreq_table_add(t1, V("add", "foo"));
+ apreq_table_addv(t1, V("add", "bar"));
+ apreq_table_addv(t1, V("add", "foo"));
val = apreq_table_get(t1, "add");
CuAssertStrEquals(tc, "bar", val);
- apreq_table_add(t1, V("f", "top"));
- apreq_table_add(t1, V("fo", "child"));
- apreq_table_add(t1, V("fro", "child-right"));
+ apreq_table_addv(t1, V("f", "top"));
+ apreq_table_addv(t1, V("fo", "child"));
+ apreq_table_addv(t1, V("fro", "child-right"));
/*
* f(5) black fo(6) black
@@ -131,14 +131,14 @@
*/
- apreq_table_add(t1, V("flo", "child-left"));
- apreq_table_add(t1, V("flr", "child-left-right"));
- apreq_table_add(t1, V("frr", "child-right-right"));
- apreq_table_add(t1, V("frl", "child-right-left"));
- apreq_table_add(t1, V("flr", "child-left-right"));
- apreq_table_add(t1, V("fll", "child-left-left"));
- apreq_table_add(t1, V("foo", "bar"));
- apreq_table_add(t1, V("b", "bah humbug"));
+ apreq_table_addv(t1, V("flo", "child-left"));
+ apreq_table_addv(t1, V("flr", "child-left-right"));
+ apreq_table_addv(t1, V("frr", "child-right-right"));
+ apreq_table_addv(t1, V("frl", "child-right-left"));
+ apreq_table_addv(t1, V("flr", "child-left-right"));
+ apreq_table_addv(t1, V("fll", "child-left-left"));
+ apreq_table_addv(t1, V("foo", "bar"));
+ apreq_table_addv(t1, V("b", "bah humbug"));
val = apreq_table_get(t1, "foo");
CuAssertStrEquals(tc, "bar", val);
val = apreq_table_get(t1, "flr");
@@ -193,17 +193,17 @@
t1 = apreq_table_make(p, 1);
- apreq_table_add(t1, V("a", "0"));
- apreq_table_add(t1, V("g", "7"));
+ apreq_table_addv(t1, V("a", "0"));
+ apreq_table_addv(t1, V("g", "7"));
- apreq_table_add(t2, V("a", "1"));
- apreq_table_add(t2, V("b", "2"));
- apreq_table_add(t2, V("c", "3"));
- apreq_table_add(t2, V("b", "2.0"));
- apreq_table_add(t2, V("d", "4"));
- apreq_table_add(t2, V("e", "5"));
- apreq_table_add(t2, V("b", "2."));
- apreq_table_add(t2, V("f", "6"));
+ apreq_table_addv(t2, V("a", "1"));
+ apreq_table_addv(t2, V("b", "2"));
+ apreq_table_addv(t2, V("c", "3"));
+ apreq_table_addv(t2, V("b", "2.0"));
+ apreq_table_addv(t2, V("d", "4"));
+ apreq_table_addv(t2, V("e", "5"));
+ apreq_table_addv(t2, V("b", "2."));
+ apreq_table_addv(t2, V("f", "6"));
/* APR_OVERLAP_TABLES_SET had funky semantics, so we ignore it here */
s = apreq_table_overlap(t1, t2, APR_OVERLAP_TABLES_MERGE);
@@ -274,17 +274,17 @@
t1 = apreq_table_make(p, 1);
- apreq_table_add(t1, V("a", "0"));
- apreq_table_add(t1, V("g", "7"));
+ apreq_table_addv(t1, V("a", "0"));
+ apreq_table_addv(t1, V("g", "7"));
- apreq_table_add(t2, V("a", "1"));
- apreq_table_add(t2, V("b", "2"));
- apreq_table_add(t2, V("c", "3"));
- apreq_table_add(t2, V("b", "2.0"));
- apreq_table_add(t2, V("d", "4"));
- apreq_table_add(t2, V("e", "5"));
- apreq_table_add(t2, V("b", "2."));
- apreq_table_add(t2, V("f", "6"));
+ apreq_table_addv(t2, V("a", "1"));
+ apreq_table_addv(t2, V("b", "2"));
+ apreq_table_addv(t2, V("c", "3"));
+ apreq_table_addv(t2, V("b", "2.0"));
+ apreq_table_addv(t2, V("d", "4"));
+ apreq_table_addv(t2, V("e", "5"));
+ apreq_table_addv(t2, V("b", "2."));
+ apreq_table_addv(t2, V("f", "6"));
t1 = apreq_table_overlay(p, t1, t2);
CuAssertIntEquals(tc, 10, apreq_table_nelts(t1));
1.6 +3 -0 httpd-apreq-2/t/test_apreq.h
Index: test_apreq.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/test_apreq.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- test_apreq.h 3 May 2003 05:22:33 -0000 1.5
+++ test_apreq.h 20 May 2003 20:27:32 -0000 1.6
@@ -57,6 +57,9 @@
#include "CuTest.h"
#include "apr_pools.h"
+#ifndef apr_table_nelts
+#define apr_table_nelts(t) apr_table_elts(t)->nelts
+#endif
/* Some simple functions to make the test apps easier to write and
* a bit more consistent...