activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r562245 - /activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/ShortTest.cpp
Date Thu, 02 Aug 2007 20:34:19 GMT
Author: tabish
Date: Thu Aug  2 13:34:18 2007
New Revision: 562245

URL: http://svn.apache.org/viewvc?view=rev&rev=562245
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Adding in more Types wrappers

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/ShortTest.cpp

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/ShortTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/ShortTest.cpp?view=diff&rev=562245&r1=562244&r2=562245
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/ShortTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/ShortTest.cpp Thu Aug  2 13:34:18
2007
@@ -45,5 +45,36 @@
     CPPUNIT_ASSERT( Short::reverseBytes( (short)0xDE00 ) == (short)0x00DE );
     CPPUNIT_ASSERT( Short::reverseBytes( (short)0x00AB ) == (short)0xAB00 );
 
+    Short short2( 255 );
+
+    // Comparison functions
+    CPPUNIT_ASSERT( short2.compareTo( 256 ) == -1 );
+    CPPUNIT_ASSERT( short2.compareTo( 255 ) == 0 );
+    CPPUNIT_ASSERT( short2.compareTo( 254 ) == 1 );
+    CPPUNIT_ASSERT( short2.equals( Short( 255 ) ) == true );
+    CPPUNIT_ASSERT( short2.compareTo( Short( 255 ) ) == 0 );
+    CPPUNIT_ASSERT( short2 == Short( 255 ) );
+
+    // decode
+    CPPUNIT_ASSERT( short2 == Short::decode( "255" ) );
+    CPPUNIT_ASSERT( short2 == Short::decode( "0xFF" ) );
+    CPPUNIT_ASSERT( short2 == Short::decode( "255" ) );
+    CPPUNIT_ASSERT( Short::decode( "-255" ) == -255 );
+
+    // parseInt
+    CPPUNIT_ASSERT( Short::parseShort( "255") == 255 );
+    CPPUNIT_ASSERT( Short::parseShort( "255", 10 ) == 255 );
+    CPPUNIT_ASSERT( Short::parseShort( "255", 11 ) != 255 );
+    CPPUNIT_ASSERT( Short::parseShort( "FF", 16 ) == 255 );
+
+    // valueOf
+    CPPUNIT_ASSERT( Short::valueOf( 255 ) == 255 );
+    CPPUNIT_ASSERT( Short::valueOf( "255" ) == 255 );
+    CPPUNIT_ASSERT( Short::valueOf( "255", 10 ) == 255 );
+    CPPUNIT_ASSERT( (Short::valueOf( "255", 11 )).shortValue() != 255 );
+    CPPUNIT_ASSERT( Short::valueOf( "FF", 16 ) == 255 );
+
+    CPPUNIT_ASSERT( Short::toString( 255 ) == "255" );
+
 }
 



Mime
View raw message