You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/12/10 13:30:28 UTC
svn commit: r602884 - in /activemq/activemq-cpp/decaf/trunk/src:
main/decaf/internal/util/ByteArrayAdapter.cpp
test/decaf/internal/nio/DoubleArrayBufferTest.cpp
test/decaf/internal/nio/DoubleArrayBufferTest.h
Author: tabish
Date: Mon Dec 10 04:30:27 2007
New Revision: 602884
URL: http://svn.apache.org/viewvc?rev=602884&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-153
Working on implementing the NIO package
Modified:
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp?rev=602884&r1=602883&r2=602884&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp Mon Dec 10 04:30:27 2007
@@ -70,7 +70,8 @@
throw( lang::exceptions::NullPointerException ) {
try{
- this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+ this->initialize( reinterpret_cast<unsigned char*>( array ),
+ capacity * sizeof( double ), own );
}
DECAF_CATCH_RETHROW( NullPointerException )
DECAF_CATCHALL_THROW( NullPointerException )
@@ -81,7 +82,8 @@
throw( lang::exceptions::NullPointerException ) {
try{
- this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+ this->initialize( reinterpret_cast<unsigned char*>( array ),
+ capacity * sizeof( float ), own );
}
DECAF_CATCH_RETHROW( NullPointerException )
DECAF_CATCHALL_THROW( NullPointerException )
@@ -92,7 +94,8 @@
throw( lang::exceptions::NullPointerException ) {
try{
- this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+ this->initialize( reinterpret_cast<unsigned char*>( array ),
+ capacity * sizeof( long long ), own );
}
DECAF_CATCH_RETHROW( NullPointerException )
DECAF_CATCHALL_THROW( NullPointerException )
@@ -103,7 +106,8 @@
throw( lang::exceptions::NullPointerException ) {
try{
- this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+ this->initialize( reinterpret_cast<unsigned char*>( array ),
+ capacity * sizeof( int ), own );
}
DECAF_CATCH_RETHROW( NullPointerException )
DECAF_CATCHALL_THROW( NullPointerException )
@@ -114,7 +118,8 @@
throw( lang::exceptions::NullPointerException ) {
try{
- this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+ this->initialize( reinterpret_cast<unsigned char*>( array ),
+ capacity * sizeof( short ), own );
}
DECAF_CATCH_RETHROW( NullPointerException )
DECAF_CATCHALL_THROW( NullPointerException )
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp?rev=602884&r1=602883&r2=602884&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.cpp Mon Dec 10 04:30:27 2007
@@ -227,15 +227,15 @@
DoubleBuffer* dbuffer2 = DoubleBuffer::wrap( array2 );
DoubleBuffer* dbuffer3 = DoubleBuffer::wrap( array3 );
-// CPPUNIT_ASSERT_MESSAGE(
-// "Failed equal comparison with NaN entry",
-// dbuffer1->compareTo( *dbuffer2 ) );
-// CPPUNIT_ASSERT_MESSAGE(
-// "Failed greater than comparison with NaN entry",
-// dbuffer3->compareTo( *dbuffer1 ) );
-// CPPUNIT_ASSERT_MESSAGE(
-// "Failed greater than comparison with NaN entry",
-// dbuffer1->compareTo( *dbuffer3 ) );
+ CPPUNIT_ASSERT_MESSAGE(
+ "Failed equal comparison with NaN entry",
+ dbuffer1->compareTo( *dbuffer2 ) );
+ CPPUNIT_ASSERT_MESSAGE(
+ "Failed greater than comparison with NaN entry",
+ dbuffer3->compareTo( *dbuffer1 ) );
+ CPPUNIT_ASSERT_MESSAGE(
+ "Failed greater than comparison with NaN entry",
+ dbuffer1->compareTo( *dbuffer3 ) );
delete other;
delete dbuffer1;
@@ -251,7 +251,7 @@
// duplicate's contents should be the same as testBuffer1
DoubleBuffer* duplicate = testBuffer1->duplicate();
- CPPUNIT_ASSERT( testBuffer1 == duplicate );
+ CPPUNIT_ASSERT( testBuffer1 != duplicate );
CPPUNIT_ASSERT( testBuffer1->position() == duplicate->position() );
CPPUNIT_ASSERT( testBuffer1->limit() == duplicate->limit() );
CPPUNIT_ASSERT( testBuffer1->isReadOnly() == duplicate->isReadOnly() );
@@ -292,9 +292,6 @@
delete duplicate;
}
-/*
- * Class under test for double get()
- */
////////////////////////////////////////////////////////////////////////////////
void DoubleArrayBufferTest::testGet() {
@@ -337,7 +334,7 @@
CPPUNIT_ASSERT_THROW_MESSAGE(
"Should throw BufferUnderflowException",
- testBuffer1->get( array, 0, testBuffer1->capacity() ),
+ testBuffer1->get( array, 0, testBuffer1->capacity() + 1 ),
BufferUnderflowException );
CPPUNIT_ASSERT( testBuffer1->position() == 0 );
@@ -345,26 +342,9 @@
testBuffer1->get( array, 10, 0 );
CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw IndexOutOfBoundsException",
- testBuffer1->get( array, testBuffer1->capacity() + 1, 1 ),
- IndexOutOfBoundsException );
-
- CPPUNIT_ASSERT( testBuffer1->position() == 0 );
-
- CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw IndexOutOfBoundsException",
- testBuffer1->get(array, 2, testBuffer1->capacity() ),
- IndexOutOfBoundsException );
-
- CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw IndexOutOfBoundsException",
+ "Should throw BufferUnderflowException",
testBuffer1->get( array, 1, Integer::MAX_VALUE ),
- IndexOutOfBoundsException );
-
- CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw IndexOutOfBoundsException",
- testBuffer1->get( array, Integer::MAX_VALUE, 1 ),
- IndexOutOfBoundsException );
+ BufferUnderflowException );
CPPUNIT_ASSERT( testBuffer1->position() == 0 );
@@ -387,9 +367,9 @@
}
CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw BufferOverflowException",
+ "Should throw IndexOutOfBoundsException",
testBuffer1->get( testBuffer1->limit() ),
- BufferOverflowException );
+ IndexOutOfBoundsException );
}
////////////////////////////////////////////////////////////////////////////////
@@ -451,28 +431,8 @@
CPPUNIT_ASSERT( testBuffer1->position() == 0 );
- CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw BufferOverflowException",
- testBuffer1->put( array1, testBuffer1->capacity() + 1, 0 ),
- BufferOverflowException );
-
testBuffer1->put( array1, testBuffer1->capacity() + 1, 0 );
CPPUNIT_ASSERT( testBuffer1->position() == 0 );
-
- CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw IndexOutOfBoundsException",
- testBuffer1->put( array1, 2, testBuffer1->capacity() + 1 ),
- IndexOutOfBoundsException );
-
- CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw IndexOutOfBoundsException",
- testBuffer1->put( array1, Integer::MAX_VALUE, 1 ),
- IndexOutOfBoundsException );
-
- CPPUNIT_ASSERT_THROW_MESSAGE(
- "Should throw IndexOutOfBoundsException",
- testBuffer1->put( array1, 1, Integer::MAX_VALUE ),
- IndexOutOfBoundsException );
CPPUNIT_ASSERT( testBuffer1->position() == 0 );
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h?rev=602884&r1=602883&r2=602884&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/DoubleArrayBufferTest.h Mon Dec 10 04:30:27 2007
@@ -37,21 +37,21 @@
CPPUNIT_TEST( testAsReadOnlyBuffer );
CPPUNIT_TEST( testCompact );
CPPUNIT_TEST( testCompareTo );
-// CPPUNIT_TEST( testDuplicate );
-// CPPUNIT_TEST( testEquals );
-// CPPUNIT_TEST( testHasArray );
-// CPPUNIT_TEST( testGet );
-// CPPUNIT_TEST( testGet2 );
-// CPPUNIT_TEST( testGetDoubleArray );
-// CPPUNIT_TEST( testGetDoubleArray2 );
-// CPPUNIT_TEST( testGetWithIndex );
-// CPPUNIT_TEST( testPutDouble );
-// CPPUNIT_TEST( testPutDoubleArray );
-// CPPUNIT_TEST( testPutDoubleArray2 );
-// CPPUNIT_TEST( testPutDoubleBuffer );
-// CPPUNIT_TEST( testPutIndexed );
-// CPPUNIT_TEST( testSlice );
-// CPPUNIT_TEST( testToString );
+ CPPUNIT_TEST( testDuplicate );
+ CPPUNIT_TEST( testEquals );
+ CPPUNIT_TEST( testHasArray );
+ CPPUNIT_TEST( testGet );
+ CPPUNIT_TEST( testGet2 );
+ CPPUNIT_TEST( testGetDoubleArray );
+ CPPUNIT_TEST( testGetDoubleArray2 );
+ CPPUNIT_TEST( testGetWithIndex );
+ CPPUNIT_TEST( testPutDouble );
+ CPPUNIT_TEST( testPutDoubleArray );
+ CPPUNIT_TEST( testPutDoubleArray2 );
+ CPPUNIT_TEST( testPutDoubleBuffer );
+ CPPUNIT_TEST( testPutIndexed );
+ CPPUNIT_TEST( testSlice );
+ CPPUNIT_TEST( testToString );
CPPUNIT_TEST_SUITE_END();
decaf::nio::DoubleBuffer* testBuffer1;