On Wed, Sep 21, 2011 at 22:56, Daniel Shahaf <[email protected]> wrote: > [email protected] wrote on Tue, Sep 20, 2011 at 13:29:07 -0000: >> Author: gstein >> Date: Tue Sep 20 13:29:06 2011 >> New Revision: 1173137 >> >> URL: http://svn.apache.org/viewvc?rev=1173137&view=rev >> Log: >> Initial test for the new spill buffer code. >> >> * build.conf: >> (spillbuf-test): new test. adjust related sections, too. >> >> * subversion/tests/libsvn_subr: >> (svn:ignore): ignore spillbuf-test >> >> * subversion/tests/libsvn_subr/spillbuf-test.c: new test >> >> Added: >> subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c >> Modified: >> subversion/trunk/build.conf >> subversion/trunk/subversion/tests/libsvn_subr/ (props changed) >> >> Modified: subversion/trunk/build.conf >> URL: >> http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1173137&r1=1173136&r2=1173137&view=diff >> ============================================================================== >> --- subversion/trunk/build.conf (original) >> +++ subversion/trunk/build.conf Tue Sep 20 13:29:06 2011 >> @@ -331,6 +331,7 @@ msvc-export = >> private\svn_token.h private\svn_adler32.h >> private\svn_temp_serializer.h private\svn_io_private.h >> private\svn_string_private.h private\svn_magic.h >> + private\svn_subr_private.h >> >> # Working copy management lib >> [libsvn_wc] >> @@ -798,6 +799,14 @@ sources = skel-test.c >> install = test >> libs = libsvn_test libsvn_subr apriconv apr >> >> +[spillbuf-test] >> +description = Test spillbuf in libsvn_subr >> +type = exe >> +path = subversion/tests/libsvn_subr >> +sources = spillbuf-test.c >> +install = test >> +libs = libsvn_test libsvn_subr apriconv apr >> + >> [stream-test] >> description = Test stream library >> type = exe >> @@ -1115,7 +1124,7 @@ libs = __ALL__ >> strings-reps-test changes-test locks-test repos-test >> checksum-test compat-test config-test hashdump-test mergeinfo-test >> opt-test path-test stream-test string-test time-test utf-test >> - target-test error-test cache-test editor-test >> + target-test error-test cache-test editor-test spillbuf-test >> revision-test >> subst_translate-test >> translate-test >> >> Propchange: subversion/trunk/subversion/tests/libsvn_subr/ >> ------------------------------------------------------------------------------ >> --- svn:ignore (original) >> +++ svn:ignore Tue Sep 20 13:29:06 2011 >> @@ -34,3 +34,4 @@ dirent_uri-test >> auth-test >> eol-test >> subst_translate-test >> +spillbuf-test >> >> Added: subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c >> URL: >> http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c?rev=1173137&view=auto >> ============================================================================== >> --- subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c (added) >> +++ subversion/trunk/subversion/tests/libsvn_subr/spillbuf-test.c Tue Sep 20 >> 13:29:06 2011 >> @@ -0,0 +1,78 @@ >> +/* >> + * spillbuf-test.c : test the spill buffer code >> + * >> + * ==================================================================== >> + * Licensed to the Apache Software Foundation (ASF) under one >> + * or more contributor license agreements. See the NOTICE file >> + * distributed with this work for additional information >> + * regarding copyright ownership. The ASF licenses this file >> + * to you 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 "svn_types.h" >> + >> +#include "private/svn_subr_private.h" >> + >> +#include "../svn_test.h" >> + >> + >> +static svn_error_t * >> +test_spillbuf_basic(apr_pool_t *pool) >> +{ >> + static const char data[] = ("abcdefghijklmnopqrstuvwxyz" >> + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >> + "0123456789"); >> + svn_spillbuf_t *buf = svn_spillbuf_create(sizeof(data) /* blocksize */, >> + 10 * sizeof(data) /* maxsize */, >> + pool); >> + int i; >> + > > sizeof(data) == strlen(data)+1. Did you really mean to use sizeof() > throughout this file? Or did you mean strlen()? > > (That off-by-one might change the semantics of some tests.)
Good point, but I don't think it matters. There isn't a strlen() or strcmp() anywhere in there, so it should be just fine. Cheers, -g

