activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r562241 - in /activemq/activemq-cpp/trunk/src/decaf/src: main/decaf/lang/Character.h test/decaf/lang/CharacterTest.cpp test/decaf/lang/CharacterTest.h
Date Thu, 02 Aug 2007 20:26:02 GMT
Author: tabish
Date: Thu Aug  2 13:26:01 2007
New Revision: 562241

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

Adding in more Types wrappers

Added:
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.h
Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h?view=diff&rev=562241&r1=562240&r2=562241
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h Thu Aug  2 13:26:01
2007
@@ -67,7 +67,7 @@
          * less than the passed in value.
          */
         virtual int compareTo( const Character& c ) const {
-            return this->value < c.value ? -1 : (this->value > c.value) ? -1
: 0;
+            return this->value < c.value ? -1 : (this->value > c.value) ? 1 :
0;
         }
 
         /**
@@ -98,7 +98,7 @@
          * less than the passed in value.
          */
         virtual int compareTo( const char& c ) const {
-            return this->value < c ? -1 : (this->value > c) ? -1 : 0;
+            return this->value < c ? -1 : (this->value > c) ? 1 : 0;
         }
 
         /**

Added: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.cpp?view=auto&rev=562241
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.cpp Thu Aug  2
13:26:01 2007
@@ -0,0 +1,50 @@
+/*
+ * 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 "CharacterTest.h"
+
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+CharacterTest::CharacterTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CharacterTest::test() {
+
+    Character character( 'b' );
+
+    CPPUNIT_ASSERT( character < 'a' == false );
+    CPPUNIT_ASSERT( character.compareTo( 'a' ) == 1 );
+    CPPUNIT_ASSERT( character.compareTo( 'b' ) == 0 );
+    CPPUNIT_ASSERT( character.compareTo( 'c' ) == -1 );
+
+    CPPUNIT_ASSERT( Character::isDigit('a') == false );
+    CPPUNIT_ASSERT( Character::isDigit('7') == true );
+    CPPUNIT_ASSERT( Character::isLowerCase('a') == true );
+    CPPUNIT_ASSERT( Character::isLowerCase('A') == false );
+    CPPUNIT_ASSERT( Character::isUpperCase('a') == false );
+    CPPUNIT_ASSERT( Character::isUpperCase('A') == true );
+    CPPUNIT_ASSERT( Character::isLetter('a') == true );
+    CPPUNIT_ASSERT( Character::isLetter('8') == false );
+    CPPUNIT_ASSERT( Character::isLetterOrDigit('a') == true );
+    CPPUNIT_ASSERT( Character::isLetterOrDigit('&') == false );
+    CPPUNIT_ASSERT( Character::digit( '9', 10 ) == 9 );
+
+}
+

Added: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.h?view=auto&rev=562241
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.h (added)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/CharacterTest.h Thu Aug  2 13:26:01
2007
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_LANG_CHARACTERTEST_H_
+#define _DECAF_LANG_CHARACTERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/lang/Character.h>
+
+namespace decaf{
+namespace lang{
+
+    class CharacterTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( CharacterTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        CharacterTest();
+        virtual ~CharacterTest() {}
+
+        virtual void test();
+
+    };
+
+}}
+
+#endif /*_DECAF_LANG_CHARACTERTEST_H_*/



Mime
View raw message