Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 90639 invoked from network); 29 Nov 2007 18:38:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Nov 2007 18:38:35 -0000 Received: (qmail 92401 invoked by uid 500); 29 Nov 2007 18:38:23 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 92381 invoked by uid 500); 29 Nov 2007 18:38:23 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 92372 invoked by uid 99); 29 Nov 2007 18:38:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Nov 2007 10:38:23 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Nov 2007 18:38:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 810BC1A9832; Thu, 29 Nov 2007 10:38:14 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r599538 - in /activemq/activemq-cpp/decaf/trunk/src: main/decaf/nio/ByteBuffer.cpp test/decaf/nio/ByteBufferTest.cpp test/decaf/nio/ByteBufferTest.h Date: Thu, 29 Nov 2007 18:38:13 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071129183814.810BC1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Thu Nov 29 10:38:08 2007 New Revision: 599538 URL: http://svn.apache.org/viewvc?rev=599538&view=rev Log: http://issues.apache.org/activemq/browse/AMQCPP-103 Working on the NIO package Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.cpp activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.h Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp?rev=599538&r1=599537&r2=599538&view=diff ============================================================================== --- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp (original) +++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp Thu Nov 29 10:38:08 2007 @@ -555,7 +555,6 @@ //////////////////////////////////////////////////////////////////////////////// float ByteBuffer::getFloat() throw( BufferUnderflowException ) { - return 0; try{ Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.cpp?rev=599538&r1=599537&r2=599538&view=diff ============================================================================== --- activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.cpp (original) +++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.cpp Thu Nov 29 10:38:08 2007 @@ -590,3 +590,612 @@ CPPUNIT_ASSERT( str.find( Integer::toString( testBuffer1->limit() ) ) > 0 ); CPPUNIT_ASSERT( str.find( Integer::toString( testBuffer1->capacity() ) ) > 0 ); } + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetChar() { + + std::vector chars; + for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) { + testBuffer1->put( i, (char)i); + chars.push_back( (char)i ); + } + testBuffer1->clear(); + + for( std::size_t i = 0; testBuffer1->remaining() != 0; i++ ) { + CPPUNIT_ASSERT( testBuffer1->getChar() == chars[i] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferUnderflowException", + testBuffer1->getChar(), + BufferUnderflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetChar2() { + + std::vector chars; + for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) { + testBuffer1->put( i, (char)i); + chars.push_back( (char)i ); + } + testBuffer1->clear(); + + for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) { + CPPUNIT_ASSERT( testBuffer1->getChar( i ) == chars[i] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->getChar( testBuffer1->capacity() + 1 ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutChar() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putChar( (char)1 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + for( std::size_t i = 0; testBuffer1->remaining() > 0; i++ ) { + + testBuffer1->mark(); + testBuffer1->putChar( (char)i ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->get() == (char)i ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferOverflowException", + testBuffer1->putChar( 'A' ), + BufferOverflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutChar2() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putChar( (char)1 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + std::size_t i = 0; + for( ; i < testBuffer1->capacity(); i++ ) { + + testBuffer1->mark(); + testBuffer1->putChar( i, (char)i ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->get( i ) == (char)i ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->putChar( i, 'A' ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetDouble() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( double ); i++ ) { + testBuffer1->putDouble( (double)i ); + values.push_back( (double)i ); + } + testBuffer1->clear(); + + for( std::size_t i = 0; + testBuffer1->remaining() >= sizeof( double ); i++ ) { + + CPPUNIT_ASSERT( testBuffer1->getDouble() == values[i] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferUnderflowException", + testBuffer1->getDouble(), + BufferUnderflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetDouble2() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( double ); i++ ) { + testBuffer1->putDouble( (double)i ); + values.push_back( (double)i ); + } + testBuffer1->clear(); + + std::size_t i = 0; + std::size_t j = 0; + + for( ; ( testBuffer1->capacity() - i ) >= sizeof( double ); i += sizeof( double ), j++ ) { + CPPUNIT_ASSERT( testBuffer1->getDouble( i ) == values[j] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->getDouble( i ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutDouble() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putDouble( 1.64684 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + for( std::size_t i = 0; testBuffer1->remaining() >= sizeof( double ); + i += sizeof( double ) ) { + + testBuffer1->mark(); + testBuffer1->putDouble( i + 48.25136 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getDouble() == ( i + 48.25136 ) ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferOverflowException", + testBuffer1->putDouble( 3.14159 ), + BufferOverflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutDouble2() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putDouble( (double)1.004 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + std::size_t i = 0; + for( ; ( testBuffer1->capacity() - i ) >= sizeof( double ); i += sizeof( double ) ) { + + testBuffer1->mark(); + testBuffer1->putDouble( i, i + 99.99 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getDouble( i ) == i + 99.99 ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->putDouble( i, 3.14159 ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetFloat() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( float ); i++ ) { + testBuffer1->putFloat( (float)i ); + values.push_back( (float)i ); + } + testBuffer1->clear(); + + for( std::size_t i = 0; + testBuffer1->remaining() >= sizeof( float ); i++ ) { + + CPPUNIT_ASSERT( testBuffer1->getFloat() == values[i] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferUnderflowException", + testBuffer1->getFloat(), + BufferUnderflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetFloat2() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( float ); i++ ) { + testBuffer1->putFloat( (float)i ); + values.push_back( (float)i ); + } + testBuffer1->clear(); + + std::size_t i = 0; + std::size_t j = 0; + + for( ; ( testBuffer1->capacity() - i ) >= sizeof( float ); i += sizeof( float ), j++ ) { + CPPUNIT_ASSERT( testBuffer1->getFloat( i ) == values[j] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->getFloat( i ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutFloat() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putFloat( 1.64684f ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + for( std::size_t i = 0; testBuffer1->remaining() >= sizeof( float ); + i += sizeof( float ) ) { + + testBuffer1->mark(); + testBuffer1->putFloat( i + 48.25136f ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getFloat() == ( i + 48.25136f ) ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferOverflowException", + testBuffer1->putFloat( 3.14159 ), + BufferOverflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutFloat2() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putFloat( (float)1.004f ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + std::size_t i = 0; + for( ; ( testBuffer1->capacity() - i ) >= sizeof( float ); i += sizeof( float ) ) { + + testBuffer1->mark(); + testBuffer1->putFloat( i, i + 99.99f ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getFloat( i ) == i + 99.99f ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->putFloat( i, 3.14159 ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetLong() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( long long ); i++ ) { + testBuffer1->putLong( (long long)i ); + values.push_back( (long long)i ); + } + testBuffer1->clear(); + + for( std::size_t i = 0; + testBuffer1->remaining() >= sizeof( long long ); i++ ) { + + CPPUNIT_ASSERT( testBuffer1->getLong() == values[i] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferUnderflowException", + testBuffer1->getLong(), + BufferUnderflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetLong2() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( long long ); i++ ) { + testBuffer1->putLong( (long long)i ); + values.push_back( (long long)i ); + } + testBuffer1->clear(); + + std::size_t i = 0; + std::size_t j = 0; + + for( ; ( testBuffer1->capacity() - i ) >= sizeof( long long ); i += sizeof( long long ), j++ ) { + CPPUNIT_ASSERT( testBuffer1->getLong( i ) == values[j] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->getLong( i ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutLong() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putLong( 15474 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + for( std::size_t i = 0; testBuffer1->remaining() >= sizeof( long long ); + i += sizeof( long long ) ) { + + testBuffer1->mark(); + testBuffer1->putLong( i + 48 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getLong() == ( i + 48 ) ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferOverflowException", + testBuffer1->putLong( 3 ), + BufferOverflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutLong2() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putLong( (long long)85 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + std::size_t i = 0; + for( ; ( testBuffer1->capacity() - i ) >= sizeof( long long ); i += sizeof( long long ) ) { + + testBuffer1->mark(); + testBuffer1->putLong( i, i + 99 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getLong( i ) == i + 99 ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->putLong( i, 3 ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetInt() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( int ); i++ ) { + testBuffer1->putInt( (int)i ); + values.push_back( (int)i ); + } + testBuffer1->clear(); + + for( std::size_t i = 0; + testBuffer1->remaining() >= sizeof( int ); i++ ) { + + CPPUNIT_ASSERT( testBuffer1->getInt() == values[i] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferUnderflowException", + testBuffer1->getInt(), + BufferUnderflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetInt2() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( int ); i++ ) { + testBuffer1->putInt( (int)i ); + values.push_back( (int)i ); + } + testBuffer1->clear(); + + std::size_t i = 0; + std::size_t j = 0; + + for( ; ( testBuffer1->capacity() - i ) >= sizeof( int ); i += sizeof( int ), j++ ) { + CPPUNIT_ASSERT( testBuffer1->getInt( i ) == values[j] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->getInt( i ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutInt() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putInt( 15474 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + for( std::size_t i = 0; testBuffer1->remaining() >= sizeof( int ); + i += sizeof( int ) ) { + + testBuffer1->mark(); + testBuffer1->putInt( i + 48 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getInt() == (int)( i + 48 ) ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferOverflowException", + testBuffer1->putInt( 3 ), + BufferOverflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutInt2() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putInt( (int)85 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + std::size_t i = 0; + for( ; ( testBuffer1->capacity() - i ) >= sizeof( int ); i += sizeof( int ) ) { + + testBuffer1->mark(); + testBuffer1->putInt( i, i + 99 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getInt( i ) == (int)(i + 99) ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->putInt( i, 3 ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetShort() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( short ); i++ ) { + testBuffer1->putShort( (short)i ); + values.push_back( (short)i ); + } + testBuffer1->clear(); + + for( std::size_t i = 0; + testBuffer1->remaining() >= sizeof( short ); i++ ) { + + CPPUNIT_ASSERT( testBuffer1->getShort() == values[i] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferUnderflowException", + testBuffer1->getShort(), + BufferUnderflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testGetShort2() { + + std::vector values; + for( std::size_t i = 0; i < testBuffer1->capacity() / sizeof( short ); i++ ) { + testBuffer1->putShort( (short)i ); + values.push_back( (short)i ); + } + testBuffer1->clear(); + + std::size_t i = 0; + std::size_t j = 0; + + for( ; ( testBuffer1->capacity() - i ) >= sizeof( short ); i += sizeof( short ), j++ ) { + CPPUNIT_ASSERT( testBuffer1->getShort( i ) == values[j] ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->getShort( i ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutShort() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putShort( 15474 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + for( std::size_t i = 0; testBuffer1->remaining() >= sizeof( short ); + i += sizeof( short ) ) { + + testBuffer1->mark(); + testBuffer1->putShort( i + 48 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getShort() == (short)( i + 48 ) ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a BufferOverflowException", + testBuffer1->putShort( 3 ), + BufferOverflowException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testPutShort2() { + + ByteBuffer* readOnly = testBuffer1->asReadOnlyBuffer(); + readOnly->clear(); + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a ReadOnlyBufferException", + readOnly->putShort( (short)85 ), + ReadOnlyBufferException ); + delete readOnly; + + testBuffer1->clear(); + + std::size_t i = 0; + for( ; ( testBuffer1->capacity() - i ) >= sizeof( short ); i += sizeof( short ) ) { + + testBuffer1->mark(); + testBuffer1->putShort( i, i + 99 ); + testBuffer1->reset(); + CPPUNIT_ASSERT( testBuffer1->getShort( i ) == (short)(i + 99) ); + } + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a IndexOutOfBoundsException", + testBuffer1->putShort( i, 3 ), + IndexOutOfBoundsException ); +} + +//////////////////////////////////////////////////////////////////////////////// +void ByteBufferTest::testWrapNullArray() { + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Should throw a NullPointerException", + testBuffer1->wrap( NULL, 0, 3 ), + NullPointerException ); +} Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.h?rev=599538&r1=599537&r2=599538&view=diff ============================================================================== --- activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.h (original) +++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/nio/ByteBufferTest.h Thu Nov 29 10:38:08 2007 @@ -49,6 +49,31 @@ CPPUNIT_TEST( testPutIndexed ); CPPUNIT_TEST( testSlice ); CPPUNIT_TEST( testToString ); + CPPUNIT_TEST( testGetChar ); + CPPUNIT_TEST( testGetChar2 ); + CPPUNIT_TEST( testPutChar ); + CPPUNIT_TEST( testPutChar2 ); + CPPUNIT_TEST( testGetDouble ); + CPPUNIT_TEST( testGetDouble2 ); + CPPUNIT_TEST( testPutDouble ); + CPPUNIT_TEST( testPutDouble2 ); + CPPUNIT_TEST( testGetFloat ); + CPPUNIT_TEST( testGetFloat2 ); + CPPUNIT_TEST( testPutFloat ); + CPPUNIT_TEST( testPutFloat2 ); + CPPUNIT_TEST( testGetLong ); + CPPUNIT_TEST( testGetLong2 ); + CPPUNIT_TEST( testPutLong ); + CPPUNIT_TEST( testPutLong2 ); + CPPUNIT_TEST( testGetInt ); + CPPUNIT_TEST( testGetInt2 ); + CPPUNIT_TEST( testPutInt ); + CPPUNIT_TEST( testPutInt2 ); + CPPUNIT_TEST( testGetShort ); + CPPUNIT_TEST( testGetShort2 ); + CPPUNIT_TEST( testPutShort ); + CPPUNIT_TEST( testPutShort2 ); + CPPUNIT_TEST( testWrapNullArray ); CPPUNIT_TEST_SUITE_END(); private: @@ -99,6 +124,31 @@ void testPutIndexed(); void testSlice(); void testToString(); + void testGetChar(); + void testGetChar2(); + void testPutChar(); + void testPutChar2(); + void testGetDouble(); + void testGetDouble2(); + void testPutDouble(); + void testPutDouble2(); + void testGetFloat(); + void testGetFloat2(); + void testPutFloat(); + void testPutFloat2(); + void testGetLong(); + void testGetLong2(); + void testPutLong(); + void testPutLong2(); + void testGetInt(); + void testGetInt2(); + void testPutInt(); + void testPutInt2(); + void testGetShort(); + void testGetShort2(); + void testPutShort(); + void testPutShort2(); + void testWrapNullArray(); };