Return-Path: Delivered-To: apmail-jakarta-avalon-cvs-archive@apache.org Received: (qmail 20550 invoked from network); 6 Mar 2002 08:18:33 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 6 Mar 2002 08:18:33 -0000 Received: (qmail 13943 invoked by uid 97); 6 Mar 2002 08:18:46 -0000 Delivered-To: qmlist-jakarta-archive-avalon-cvs@jakarta.apache.org Received: (qmail 13909 invoked by uid 97); 6 Mar 2002 08:18:45 -0000 Mailing-List: contact avalon-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-cvs@jakarta.apache.org Received: (qmail 13898 invoked by uid 97); 6 Mar 2002 08:18:45 -0000 Date: 6 Mar 2002 08:18:30 -0000 Message-ID: <20020306081830.6517.qmail@icarus.apache.org> From: leosutic@apache.org To: jakarta-avalon-excalibur-cvs@apache.org Subject: cvs commit: jakarta-avalon-excalibur/src/test/org/apache/avalon/excalibur/collections/test VariableSizeBufferTestCase.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N leosutic 02/03/06 00:18:30 Added: src/test/org/apache/avalon/excalibur/collections/test VariableSizeBufferTestCase.java Log: Test case exposing a buffer resize bug. This bug has been fixed, and the test case is added for regression testing purposes. Revision Changes Path 1.1 jakarta-avalon-excalibur/src/test/org/apache/avalon/excalibur/collections/test/VariableSizeBufferTestCase.java Index: VariableSizeBufferTestCase.java =================================================================== package org.apache.avalon.excalibur.collections.test; import junit.framework.TestCase; import junit.framework.Test; import junit.framework.TestSuite; import org.apache.avalon.excalibur.collections.VariableSizeBuffer; public class VariableSizeBufferTestCase extends TestCase { public VariableSizeBufferTestCase( final String name ) { super( name ); } /** * Triggers a situation when m_tail < m_head during buffer * extension, so copying will be wrapping around the end of * the buffer. */ public void testGrowthWrapAround () throws Exception { VariableSizeBuffer buf = new VariableSizeBuffer(1); buf.add("1"); assertEquals("Got 1 that just added", "1", buf.remove()); buf.add("2"); buf.add("3"); assertEquals("After 3 puts and 1 remove buffer size must be 2", 2, buf.size()); assertEquals("Got 2", "2", buf.remove()); assertEquals("Got 3", "3", buf.remove()); assertTrue("Buffer is empty", buf.isEmpty()); } /** * Extension is done when m_head = 0 and m_tail = m_buffer.length - 1. */ public void testGrowthCopyStartToEnd() { VariableSizeBuffer buf = new VariableSizeBuffer(1); buf.add("1"); buf.add("2"); assertEquals("After 2 puts buffer size must be 2", 2, buf.size()); assertEquals("Got 1", "1", buf.remove()); assertEquals("Got 2", "2", buf.remove()); assertTrue("Buffer is empty", buf.isEmpty()); } } -- To unsubscribe, e-mail: For additional commands, e-mail: