You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2004/06/22 18:26:45 UTC
cvs commit: apr-util/test testbuckets.c abts_tests.h Makefile.in
jorton 2004/06/22 09:26:45
Modified: test abts_tests.h Makefile.in
Added: test testbuckets.c
Log:
Add some simple bucket tests:
* test/testbuckets.c: New file.
* test/Makefile.in, test/abts_tests.h: Add testbuckets to test suite.
Revision Changes Path
1.4 +4 -3 apr-util/test/abts_tests.h
Index: abts_tests.h
===================================================================
RCS file: /home/cvs/apr-util/test/abts_tests.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -d -w -u -r1.3 -r1.4
--- abts_tests.h 22 Jun 2004 10:24:51 -0000 1.3
+++ abts_tests.h 22 Jun 2004 16:26:45 -0000 1.4
@@ -22,9 +22,10 @@
const struct testlist {
abts_suite *(*func)(abts_suite *suite);
} alltests[] = {
- (teststrmatch),
- (testuri),
- {testuuid}
+ {teststrmatch},
+ {testuri},
+ {testuuid},
+ {testbuckets}
};
#endif /* APR_TEST_INCLUDES */
1.44 +2 -1 apr-util/test/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apr-util/test/Makefile.in,v
retrieving revision 1.43
retrieving revision 1.44
diff -d -w -u -r1.43 -r1.44
--- Makefile.in 22 Jun 2004 10:24:51 -0000 1.43
+++ Makefile.in 22 Jun 2004 16:26:45 -0000 1.44
@@ -71,7 +71,8 @@
testpass: $(testpass_OBJECTS) $(testpass_LDADD)
$(LINK) $(APRUTIL_LDFLAGS) $(testpass_OBJECTS) $(testpass_LDADD) $(PROGRAM_DEPENDENCIES)
-testall_OBJECTS = teststrmatch.lo testuri.lo testuuid.lo abts.lo testutil.lo
+testall_OBJECTS = teststrmatch.lo testuri.lo testuuid.lo abts.lo testutil.lo \
+ testbuckets.lo
testall_LDADD = $(TARGET_LIB_PATH)
testall: $(testall_OBJECTS) $(testall_LDADD)
$(LINK) $(APRUTIL_LDFLAGS) $(testall_OBJECTS) $(testall_LDADD) $(PROGRAM_DEPENDENCIES)
1.1 apr-util/test/testbuckets.c
Index: testbuckets.c
===================================================================
/* Copyright 2000-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "abts.h"
#include "testutil.h"
#include "apr_buckets.h"
static void test_create(abts_case *tc, void *data)
{
apr_bucket_alloc_t *ba;
apr_bucket_brigade *bb;
ba = apr_bucket_alloc_create(p);
bb = apr_brigade_create(p, ba);
ABTS_ASSERT(tc, "new brigade not NULL", bb != NULL);
ABTS_ASSERT(tc, "new brigade is empty", APR_BRIGADE_EMPTY(bb));
apr_brigade_destroy(bb);
apr_bucket_alloc_destroy(ba);
}
static void test_simple(abts_case *tc, void *data)
{
apr_bucket_alloc_t *ba;
apr_bucket_brigade *bb;
apr_bucket *fb, *tb;
ba = apr_bucket_alloc_create(p);
bb = apr_brigade_create(p, ba);
fb = APR_BRIGADE_FIRST(bb);
ABTS_ASSERT(tc, "first bucket of empty brigade is sentinel",
fb == APR_BRIGADE_SENTINEL(bb));
fb = apr_bucket_flush_create(ba);
APR_BRIGADE_INSERT_HEAD(bb, fb);
ABTS_ASSERT(tc, "first bucket of brigade is flush",
APR_BRIGADE_FIRST(bb) == fb);
ABTS_ASSERT(tc, "bucket after flush is sentinel",
APR_BUCKET_NEXT(fb) == APR_BRIGADE_SENTINEL(bb));
tb = apr_bucket_transient_create("aaa", 3, ba);
APR_BUCKET_INSERT_BEFORE(fb, tb);
ABTS_ASSERT(tc, "bucket before flush now transient",
APR_BUCKET_PREV(fb) == tb);
ABTS_ASSERT(tc, "bucket after transient is flush",
APR_BUCKET_NEXT(tb) == fb);
apr_brigade_destroy(bb);
apr_bucket_alloc_destroy(ba);
}
abts_suite *testbuckets(abts_suite *suite)
{
suite = ADD_SUITE(suite);
abts_run_test(suite, test_create, NULL);
abts_run_test(suite, test_simple, NULL);
return suite;
}