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 2008/04/29 22:52:37 UTC

svn commit: r652104 [27/29] - in /activemq/activemq-cpp/trunk: ./ m4/ src/examples/ src/examples/consumers/ src/main/ src/main/decaf/ src/main/decaf/internal/ src/main/decaf/internal/net/ src/main/decaf/internal/nio/ src/main/decaf/internal/util/ src/m...

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,395 @@
+/*
+ * 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 "FloatTest.h"
+
+#include <decaf/lang/Float.h>
+#include <decaf/lang/Integer.h>
+#include <decaf/lang/Long.h>
+#include <decaf/lang/Math.h>
+#include <string>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+const int FloatTest::rawBitsFor3_4eN38To38[] = {
+    0x1394470, 0x2e7958c, 0x490bd77, 0x634ecd5,
+    0x7e2280b, 0x98d5907, 0xb30af48, 0xcdcdb1a, 0xe8a08f0, 0x102c8b2d, 0x11d7adf8,
+    0x1386ccbb, 0x15287fe9, 0x16d29fe4, 0x1883a3ee, 0x1a248cea, 0x1bcdb025, 0x1d808e17,
+    0x1f20b19d, 0x20c8de04, 0x227b1585, 0x241ced73, 0x25c428d0, 0x27753303, 0x29193fe2,
+    0x2abf8fdb, 0x2c6f73d1, 0x2e15a863, 0x2fbb127c, 0x3169d71a, 0x33122671, 0x34b6b00d,
+    0x36645c10, 0x380eb98a, 0x39b267ec, 0x3b5f01e8, 0x3d0b6131, 0x3eae397d, 0x4059c7dc,
+    0x42081cea, 0x43aa2424, 0x4554ad2d, 0x4704ec3c, 0x48a6274b, 0x4a4fb11e, 0x4c01ceb3,
+    0x4da2425f, 0x4f4ad2f7, 0x50fd87b5, 0x529e74d1, 0x54461205, 0x55f79687, 0x579abe14,
+    0x59416d99, 0x5af1c900, 0x5c971da0, 0x5e3ce508, 0x5fec1e4a, 0x619392ee, 0x633877a9,
+    0x64e69594, 0x66901d7c, 0x683424dc, 0x69e12e12, 0x6b8cbccb, 0x6d2febfe, 0x6edbe6fe,
+    0x7089705f, 0x722bcc76, 0x73d6bf94, 0x758637bc, 0x7727c5ac, 0x78d1b717, 0x7a83126e,
+    0x7c23d70a, 0x7dcccccc, 0x7f7fffff };
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string FloatTest::expectedStringFor3_4eN38To38[] = {
+    "3.4028235E-38", "3.4028235E-37",
+    "3.4028233E-36", "3.4028234E-35", "3.4028236E-34", "3.4028236E-33",
+    "3.4028234E-32", "3.4028234E-31", "3.4028233E-30", "3.4028236E-29",
+    "3.4028235E-28", "3.4028235E-27", "3.4028233E-26", "3.4028235E-25",
+    "3.4028233E-24", "3.4028235E-23", "3.4028236E-22", "3.4028235E-21",
+    "3.4028236E-20", "3.4028236E-19", "3.4028236E-18", "3.4028235E-17",
+    "3.4028236E-16", "3.4028234E-15", "3.4028234E-14", "3.4028235E-13",
+    "3.4028234E-12", "3.4028235E-11", "3.4028236E-10", "3.4028234E-9", "3.4028236E-8",
+    "3.4028236E-7", "3.4028235E-6", "3.4028235E-5", "3.4028233E-4", "0.0034028236",
+    "0.034028236", "0.34028235", "3.4028234", "34.028236", "340.28235", "3402.8235",
+    "34028.234", "340282.34", "3402823.5", "3.4028236E7", "3.40282336E8",
+    "3.40282342E9", "3.40282348E10", "3.40282343E11", "3.40282337E12", "3.40282353E13",
+    "3.4028234E14", "3.4028234E15", "3.40282356E16", "3.40282356E17", "3.40282356E18",
+    "3.4028236E19", "3.4028235E20", "3.4028233E21", "3.4028235E22", "3.4028233E23",
+    "3.4028236E24", "3.4028234E25", "3.4028233E26", "3.4028234E27", "3.4028235E28",
+    "3.4028236E29", "3.4028233E30", "3.4028235E31", "3.4028233E32", "3.4028236E33",
+    "3.4028236E34", "3.4028234E35", "3.4028236E36", "3.4028235E37", "3.4028235E38" };
+
+////////////////////////////////////////////////////////////////////////////////
+const int FloatTest::rawBitsFor1_17eN38To38[] = {
+    0x80800000, 0x82200000, 0x83c80000,
+    0x857a0000, 0x871c4000, 0x88c35000, 0x8a742400, 0x8c189680, 0x8dbebc20, 0x8f6e6b28,
+    0x911502f9, 0x92ba43b7, 0x9468d4a5, 0x961184e7, 0x97b5e621, 0x99635fa9, 0x9b0e1bca,
+    0x9cb1a2bc, 0x9e5e0b6b, 0xa00ac723, 0xa1ad78ec, 0xa358d727, 0xa5078678, 0xa6a96816,
+    0xa853c21c, 0xaa045951, 0xaba56fa6, 0xad4ecb8f, 0xaf013f39, 0xb0a18f08, 0xb249f2ca,
+    0xb3fc6f7c, 0xb59dc5ae, 0xb7453719, 0xb8f684df, 0xba9a130c, 0xbc4097ce, 0xbdf0bdc2,
+    0xbf967699, 0xc13c1440, 0xc2eb1950, 0xc492efd2, 0xc637abc6, 0xc7e596b8, 0xc98f7e33,
+    0xcb335dc0, 0xcce0352f, 0xce8c213e, 0xd02f298d, 0xd1daf3f0, 0xd388d876, 0xd52b0e94,
+    0xd6d5d239, 0xd885a363, 0xda270c3c, 0xdbd0cf4b, 0xdd82818f, 0xdf2321f3, 0xe0cbea70,
+    0xe27ee50b, 0xe41f4f27, 0xe5c722f1, 0xe778ebad, 0xe91b934c, 0xeac2781f, 0xec731627,
+    0xee17edd8, 0xefbde94f, 0xf16d63a2, 0xf3145e45, 0xf4b975d7, 0xf667d34c, 0xf810e410,
+    0xf9b51d14, 0xfb626459, 0xfd0d7eb7, 0xfeb0de65 };
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string FloatTest::expectedStringFor1_17eN38To38[] = {
+    "-1.17549435E-38",
+    "-1.1754944E-37", "-1.17549435E-36", "-1.17549435E-35", "-1.1754944E-34",
+    "-1.17549435E-33", "-1.17549435E-32", "-1.1754944E-31", "-1.17549435E-30",
+    "-1.17549435E-29", "-1.1754944E-28", "-1.1754943E-27", "-1.17549435E-26",
+    "-1.1754943E-25", "-1.1754944E-24", "-1.1754943E-23", "-1.1754944E-22",
+    "-1.1754943E-21", "-1.1754943E-20", "-1.1754943E-19", "-1.1754944E-18",
+    "-1.1754944E-17", "-1.1754943E-16", "-1.1754943E-15", "-1.1754944E-14",
+    "-1.1754943E-13", "-1.1754944E-12", "-1.1754943E-11", "-1.1754943E-10",
+    "-1.1754944E-9", "-1.1754944E-8", "-1.1754943E-7", "-1.1754944E-6",
+    "-1.1754943E-5", "-1.1754943E-4", "-0.0011754944", "-0.011754943", "-0.117549434",
+    "-1.1754943", "-11.754944", "-117.54944", "-1175.4944", "-11754.943", "-117549.44",
+    "-1175494.4", "-1.1754944E7", "-1.17549432E8", "-1.1754944E9", "-1.17549435E10",
+    "-1.17549433E11", "-1.17549433E12", "-1.17549438E13", "-1.17549438E14",
+    "-1.1754943E15", "-1.17549432E16", "-1.17549432E17", "-1.17549434E18",
+    "-1.1754944E19", "-1.1754944E20", "-1.1754943E21", "-1.1754943E22",
+    "-1.1754944E23", "-1.17549434E24", "-1.1754943E25", "-1.1754943E26",
+    "-1.17549434E27", "-1.1754943E28", "-1.1754944E29", "-1.1754943E30",
+    "-1.1754943E31", "-1.1754944E32", "-1.1754943E33", "-1.1754944E34",
+    "-1.1754944E35", "-1.1754944E36", "-1.1754943E37", "-1.1754943E38" };
+
+////////////////////////////////////////////////////////////////////////////////
+FloatTest::FloatTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::doTestCompareRawBits( const std::string& originalFloatString,
+                                      int expectedRawBits,
+                                      const std::string& expectedString ) {
+
+    int rawBits;
+    float result = Float::parseFloat( originalFloatString );
+    rawBits = Float::floatToIntBits( result );
+    CPPUNIT_ASSERT_MESSAGE(
+        std::string( "Original float(" ) + originalFloatString +
+        ") Converted float(" + Float::toString( result ) +
+        ") Expecting:" + Integer::toHexString( expectedRawBits ) +
+        " Got: " + Integer::toHexString( rawBits ),
+        expectedRawBits == rawBits );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_ConstructorF() {
+    // Test for method decaf.lang.Float(float)
+    Float f( 900.89f );
+    CPPUNIT_ASSERT_MESSAGE( "Created incorrect float", f.floatValue() == 900.89f );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_ConstructorString() {
+    // Test for method decaf.lang.Float(decaf.lang.String)
+    // TODO
+    //Float f( "900.89" );
+    //CPPUNIT_ASSERT_MESSAGE("Created incorrect Float", f.floatValue() == 900.89f);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_byteValue() {
+    // Test for method byte decaf.lang.Float::byteValue()
+    Float f( 0.46874f );
+    Float f2( 90.8f );
+
+    CPPUNIT_ASSERT_MESSAGE( "Returned incorrect byte value",
+                            f.byteValue() == 0 && f2.byteValue() == 90 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_compare() {
+
+    float values[] = { Float::NEGATIVE_INFINITY,
+                       -Float::MAX_VALUE,
+                       -2.0f,
+                       -Float::MIN_VALUE,
+                       -0.0f, 0.0f,
+                       Float::MIN_VALUE,
+                       2.0f,
+                       Float::MAX_VALUE,
+                       Float::POSITIVE_INFINITY,
+                       Float::NaN };
+
+    for( std::size_t i = 0; i < sizeof(values) / sizeof(float); i++ ) {
+
+        float f1 = values[i];
+        CPPUNIT_ASSERT_MESSAGE( "compare() should be equal:",
+                                Float::compare( f1, f1 ) == 0 );
+        Float F1( f1 );
+        CPPUNIT_ASSERT_MESSAGE( "compareTo() should be equal: ",
+                                F1.compareTo( F1 ) == 0);
+
+        for( std::size_t j = i + 1; j < sizeof(values) / sizeof(float); j++ ) {
+            float f2 = values[j];
+            CPPUNIT_ASSERT_MESSAGE( "compare() should be less ",
+                    Float::compare(f1, f2) == -1 );
+            CPPUNIT_ASSERT_MESSAGE( "compare() should be greater ",
+                    Float::compare(f2, f1) == 1 );
+            Float F2(f2);
+            CPPUNIT_ASSERT_MESSAGE( "compareTo() should be less ",
+                                    F1.compareTo(F2) == -1 );
+            CPPUNIT_ASSERT_MESSAGE( "compareTo() should be greater ",
+                                    F2.compareTo(F1) == 1 );
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_doubleValue() {
+    // Test for method double decaf.lang.Float::doubleValue()
+    CPPUNIT_ASSERT_MESSAGE(
+        "Incorrect double value returned",
+        Math::abs( Float( 999999.999f ).doubleValue() - 999999.999 ) < 1 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_floatToIntBitsF() {
+    float f = 9876.2345f;
+    int bits = Float::floatToIntBits( f );
+    float r = Float::intBitsToFloat( bits );
+    CPPUNIT_ASSERT_MESSAGE("Incorrect intBits returned", f == r);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_floatToRawIntBitsF() {
+    int i = 0x7fc004d2;
+    float f = Float::intBitsToFloat( i );
+    CPPUNIT_ASSERT_MESSAGE( "Wrong raw bits", Float::floatToRawIntBits(f) == i );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_floatValue() {
+    // Test for method float decaf.lang.Float::floatValue()
+    Float f( 87.657f );
+    Float f2( -0.876f );
+    CPPUNIT_ASSERT_MESSAGE( "Returned incorrect floatValue",
+                            f.floatValue() == 87.657f &&
+                            ( f2.floatValue() == -0.876f ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_intBitsToFloatI() {
+    float f = 9876.2345f;
+    int bits = Float::floatToIntBits(f);
+    float r = Float::intBitsToFloat(bits);
+    CPPUNIT_ASSERT_MESSAGE("Incorrect intBits returned", f == r );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_intValue() {
+    // Test for method int decaf.lang.Float::intValue()
+    Float f( 0.46874f );
+    Float f2( 90.8f );
+    CPPUNIT_ASSERT_MESSAGE( "Returned incorrect int value",
+                            f.intValue() == 0 && f2.intValue() == 90 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_isInfinite() {
+    // Test for method boolean decaf.lang.Float::isInfinite()
+    CPPUNIT_ASSERT_MESSAGE("Infinity check failed",
+            Float( Float::POSITIVE_INFINITY ).isInfinite() &&
+            Float( Float::NEGATIVE_INFINITY ).isInfinite() &&
+            !(Float( 0.13131414f ).isInfinite() ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_isInfiniteF() {
+    // Test for method boolean decaf.lang.Float::isInfinite(float)
+
+    CPPUNIT_ASSERT_MESSAGE( "Infinity check failed",
+        Float::isInfinite( Float::POSITIVE_INFINITY ) &&
+        (Float::isInfinite( Float::NEGATIVE_INFINITY) ) &&
+         !( Float::isInfinite( 1.0f ) ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_isNaN() {
+    // Test for method boolean decaf.lang.Float::isNaN()
+    CPPUNIT_ASSERT_MESSAGE( "NAN check failed",
+        Float( Float::NaN ).isNaN() && !( Float( 1.0f ).isNaN() ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_isNaNF() {
+    // Test for method boolean decaf.lang.Float::isNaN(float)
+    CPPUNIT_ASSERT_MESSAGE( "NaN check failed",
+        Float::isNaN( Float::NaN ) && !( Float::isNaN( 12.09f ) ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_longValue() {
+    // Test for method long decaf.lang.Float::longValue()
+    Float f( 0.46874f );
+    Float f2( 90.8f );
+    CPPUNIT_ASSERT_MESSAGE( "Returned incorrect long value",
+        f.longValue() == 0 && f2.longValue() == 90 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void FloatTest::test_parseFloatLDecaf_lang_String() {
+
+    // TODO
+//    CPPUNIT_ASSERT_MESSAGE( "Incorrect float returned, expected zero.",
+//            0.0 == Float::parseFloat("7.0064923216240853546186479164495e-46"));
+//    CPPUNIT_ASSERT_MESSAGE("Incorrect float returned, expected minimum float.",
+//            Float::MIN_VALUE ==
+//            Float::parseFloat("7.0064923216240853546186479164496e-46") );
+
+//    doTestCompareRawBits(
+//            "0.000000000000000000000000000000000000011754942807573642917278829910357665133228589927589904276829631184250030649651730385585324256680905818939208984375",
+//            0x800000, "1.17549435E-38");
+//    doTestCompareRawBits(
+//            "0.00000000000000000000000000000000000001175494280757364291727882991035766513322858992758990427682963118425003064965173038558532425668090581893920898437499999f",
+//            0x7fffff, "1.1754942E-38");
+//
+//    /* Test a set of regular floats with exponents from -38 to +38 */
+//    for (int i = 38; i > 3; i--) {
+//        std::string testString;
+//        testString = "3.4028234663852886e-" + i;
+//        doTestCompareRawBits(testString, rawBitsFor3_4eN38To38[38 - i],
+//                expectedStringFor3_4eN38To38[38 - i]);
+//    }
+//    doTestCompareRawBits("3.4028234663852886e-3", rawBitsFor3_4eN38To38[38 - 3],
+//            expectedStringFor3_4eN38To38[38 - 3]);
+//    doTestCompareRawBits("3.4028234663852886e-2", rawBitsFor3_4eN38To38[38 - 2],
+//            expectedStringFor3_4eN38To38[38 - 2]);
+//    doTestCompareRawBits("3.4028234663852886e-1", rawBitsFor3_4eN38To38[38 - 1],
+//            expectedStringFor3_4eN38To38[38 - 1]);
+//    doTestCompareRawBits("3.4028234663852886e-0", rawBitsFor3_4eN38To38[38 - 0],
+//            expectedStringFor3_4eN38To38[38 - 0]);
+//    doTestCompareRawBits("3.4028234663852886e+1", rawBitsFor3_4eN38To38[38 + 1],
+//            expectedStringFor3_4eN38To38[38 + 1]);
+//    doTestCompareRawBits("3.4028234663852886e+2", rawBitsFor3_4eN38To38[38 + 2],
+//            expectedStringFor3_4eN38To38[38 + 2]);
+//    doTestCompareRawBits("3.4028234663852886e+3", rawBitsFor3_4eN38To38[38 + 3],
+//            expectedStringFor3_4eN38To38[38 + 3]);
+//    doTestCompareRawBits("3.4028234663852886e+4", rawBitsFor3_4eN38To38[38 + 4],
+//            expectedStringFor3_4eN38To38[38 + 4]);
+//    doTestCompareRawBits("3.4028234663852886e+5", rawBitsFor3_4eN38To38[38 + 5],
+//            expectedStringFor3_4eN38To38[38 + 5]);
+//    doTestCompareRawBits("3.4028234663852886e+6", rawBitsFor3_4eN38To38[38 + 6],
+//            expectedStringFor3_4eN38To38[38 + 6]);
+//
+//    for (int i = 7; i < 39; i++) {
+//        std::string testString;
+//        testString = "3.4028234663852886e+" + i;
+//        doTestCompareRawBits(testString, rawBitsFor3_4eN38To38[38 + i],
+//                expectedStringFor3_4eN38To38[38 + i]);
+//    }
+//
+//    /* Test another set of regular floats with exponents from -38 to +38 */
+//    for (int i = 38; i > 3; i--) {
+//        std::string testString;
+//        testString = "-1.1754943508222875e-" + i;
+//        doTestCompareRawBits(testString, rawBitsFor1_17eN38To38[38 - i],
+//                expectedStringFor1_17eN38To38[38 - i]);
+//    }
+//    doTestCompareRawBits("-1.1754943508222875e-3", rawBitsFor1_17eN38To38[38 - 3],
+//            expectedStringFor1_17eN38To38[38 - 3]);
+//    doTestCompareRawBits("-1.1754943508222875e-2", rawBitsFor1_17eN38To38[38 - 2],
+//            expectedStringFor1_17eN38To38[38 - 2]);
+//    doTestCompareRawBits("-1.1754943508222875e-1", rawBitsFor1_17eN38To38[38 - 1],
+//            expectedStringFor1_17eN38To38[38 - 1]);
+//    doTestCompareRawBits("-1.1754943508222875e-0", rawBitsFor1_17eN38To38[38 - 0],
+//            expectedStringFor1_17eN38To38[38 - 0]);
+//    doTestCompareRawBits("-1.1754943508222875e+1", rawBitsFor1_17eN38To38[38 + 1],
+//            expectedStringFor1_17eN38To38[38 + 1]);
+//    doTestCompareRawBits("-1.1754943508222875e+2", rawBitsFor1_17eN38To38[38 + 2],
+//            expectedStringFor1_17eN38To38[38 + 2]);
+//    doTestCompareRawBits("-1.1754943508222875e+3", rawBitsFor1_17eN38To38[38 + 3],
+//            expectedStringFor1_17eN38To38[38 + 3]);
+//    doTestCompareRawBits("-1.1754943508222875e+4", rawBitsFor1_17eN38To38[38 + 4],
+//            expectedStringFor1_17eN38To38[38 + 4]);
+//    doTestCompareRawBits("-1.1754943508222875e+5", rawBitsFor1_17eN38To38[38 + 5],
+//            expectedStringFor1_17eN38To38[38 + 5]);
+//    doTestCompareRawBits("-1.1754943508222875e+6", rawBitsFor1_17eN38To38[38 + 6],
+//            expectedStringFor1_17eN38To38[38 + 6]);
+
+//    for( int i = 7; i < 39; i++ ) {
+//        std::string testString;
+//        testString = "-1.1754943508222875e+" + Integer::toString( i );
+//        doTestCompareRawBits( testString,
+//                              rawBitsFor1_17eN38To38[38 + i],
+//                              expectedStringFor1_17eN38To38[38 + i] );
+//    }
+
+//    // Test denormalized floats (floats with exponents <= -38
+//    doTestCompareRawBits("1.1012984643248170E-45", 1, "1.4E-45");
+//    doTestCompareRawBits("-1.1012984643248170E-45", 0x80000001, "-1.4E-45");
+//    doTestCompareRawBits("1.0E-45", 1, "1.4E-45");
+//    doTestCompareRawBits("-1.0E-45", 0x80000001, "-1.4E-45");
+//    doTestCompareRawBits("0.9E-45", 1, "1.4E-45");
+//    doTestCompareRawBits("-0.9E-45", 0x80000001, "-1.4E-45");
+//    doTestCompareRawBits("4.203895392974451e-45", 3, "4.2E-45");
+//    doTestCompareRawBits("-4.203895392974451e-45", 0x80000003, "-4.2E-45");
+//    doTestCompareRawBits("0.004E-45", 0, "0.0");
+//    doTestCompareRawBits("-0.004E-45", 0x80000000, "-0.0");
+//
+//    // Test for large floats close to and greater than 3.4028235E38 and
+//    // -3.4028235E38
+//    doTestCompareRawBits("1.2E+38", 0x7eb48e52, "1.2E38");
+//    doTestCompareRawBits("-1.2E+38", 0xfeb48e52, "-1.2E38");
+//    doTestCompareRawBits("3.2E+38", 0x7f70bdc2, "3.2E38");
+//    doTestCompareRawBits("-3.2E+38", 0xff70bdc2, "-3.2E38");
+//    doTestCompareRawBits("3.4E+38", 0x7f7fc99e, "3.4E38");
+//    doTestCompareRawBits("-3.4E+38", 0xff7fc99e, "-3.4E38");
+//    doTestCompareRawBits("3.4028234663852886E+38", 0x7f7fffff, "3.4028235E38");
+//    doTestCompareRawBits("-3.4028234663852886E+38", 0xff7fffff, "-3.4028235E38");
+//    doTestCompareRawBits("3.405E+38", 0x7f800000, "Infinity");
+//    doTestCompareRawBits("-3.405E+38", 0xff800000, "-Infinity");
+//    doTestCompareRawBits("3.41E+38", 0x7f800000, "Infinity");
+//    doTestCompareRawBits("-3.41E+38", 0xff800000, "-Infinity");
+//    doTestCompareRawBits("3.42E+38", 0x7f800000, "Infinity");
+//    doTestCompareRawBits("-3.42E+38", 0xff800000, "-Infinity");
+//    doTestCompareRawBits("1.0E+39", 0x7f800000, "Infinity");
+//    doTestCompareRawBits("-1.0E+39", 0xff800000, "-Infinity");
+}

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/FloatTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,100 @@
+/*
+ * 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_FLOATTEST_H_
+#define _DECAF_LANG_FLOATTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf{
+namespace lang{
+
+    class FloatTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( FloatTest );
+        CPPUNIT_TEST( test_ConstructorF );
+        CPPUNIT_TEST( test_ConstructorString );
+        CPPUNIT_TEST( test_byteValue );
+        CPPUNIT_TEST( test_compare );
+        CPPUNIT_TEST( test_doubleValue );
+        CPPUNIT_TEST( test_floatToIntBitsF );
+        CPPUNIT_TEST( test_floatToRawIntBitsF );
+        CPPUNIT_TEST( test_floatValue );
+        CPPUNIT_TEST( test_intBitsToFloatI );
+        CPPUNIT_TEST( test_intValue );
+        CPPUNIT_TEST( test_isInfinite );
+        CPPUNIT_TEST( test_isInfiniteF );
+        CPPUNIT_TEST( test_isNaN );
+        CPPUNIT_TEST( test_isNaNF );
+        CPPUNIT_TEST( test_longValue );
+        CPPUNIT_TEST( test_parseFloatLDecaf_lang_String );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        static const int rawBitsFor3_4eN38To38[];
+        static const std::string expectedStringFor3_4eN38To38[];
+        static const int rawBitsFor1_17eN38To38[];
+        static const std::string expectedStringFor1_17eN38To38[];
+
+        FloatTest();
+        virtual ~FloatTest() {}
+
+        void test_ConstructorF();
+        void test_ConstructorString();
+        void test_byteValue();
+        void test_compare();
+        void test_doubleValue();
+        void test_floatToIntBitsF();
+        void test_floatToRawIntBitsF();
+        void test_floatValue();
+        void test_intBitsToFloatI();
+        void test_intValue();
+        void test_isInfinite();
+        void test_isInfiniteF();
+        void test_isNaN();
+        void test_isNaNF();
+        void test_longValue();
+        void test_parseFloatLDecaf_lang_String();
+
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+//        void test_byteValue();
+
+    private:
+
+        void doTestCompareRawBits( const std::string& originalFloatString,
+                                   int expectedRawBits,
+                                   const std::string& expectedString );
+
+    };
+
+}}
+
+#endif /*_DECAF_LANG_FLOATTEST_H_*/

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,109 @@
+/*
+ * 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 "IntegerTest.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+void IntegerTest::test(void)
+{
+    int x = Integer::parseInt("12");
+    int y = Integer::parseInt("FF", 16);
+    int z = Integer::parseInt("42");
+
+    CPPUNIT_ASSERT( x == 12 );
+    CPPUNIT_ASSERT( y == 255 );
+    CPPUNIT_ASSERT( z == 42 );
+
+    std::string x1 = Integer::toString( x );
+    std::string y1 = Integer::toString( y );
+    std::string z1 = Integer::toString( z );
+
+    CPPUNIT_ASSERT( x1 == "12" );
+    CPPUNIT_ASSERT( y1 == "255" );
+    CPPUNIT_ASSERT( z1 == "42" );
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void IntegerTest::test2() {
+    Integer integer( 255 );
+
+    // Test cast functions
+    CPPUNIT_ASSERT( integer.byteValue() == 255 );
+    CPPUNIT_ASSERT( integer.shortValue() ==  255 );
+    CPPUNIT_ASSERT( integer.intValue() == 255 );
+    CPPUNIT_ASSERT( integer.longValue() == 255 );
+    CPPUNIT_ASSERT( integer.floatValue() == 255.0f );
+    CPPUNIT_ASSERT( integer.doubleValue() == 255.0 );
+
+    // Comparison functions
+    CPPUNIT_ASSERT( integer.compareTo( 256 ) == -1 );
+    CPPUNIT_ASSERT( integer.compareTo( 255 ) == 0 );
+    CPPUNIT_ASSERT( integer.compareTo( 254 ) == 1 );
+    CPPUNIT_ASSERT( integer.equals( Integer( 255 ) ) == true );
+    CPPUNIT_ASSERT( integer.compareTo( Integer( 255 ) ) == 0 );
+    CPPUNIT_ASSERT( integer == Integer( 255 ) );
+
+    // decode
+    CPPUNIT_ASSERT( integer == Integer::decode( "255" ) );
+    CPPUNIT_ASSERT( integer == Integer::decode( "0xFF" ) );
+    CPPUNIT_ASSERT( integer == Integer::decode( "255" ) );
+    CPPUNIT_ASSERT( Integer::decode( "-255" ) == -255 );
+
+    // reverseBytes
+    CPPUNIT_ASSERT( (int)0xFF000000 == Integer::reverseBytes( 255 ) );
+
+    // reverse
+    CPPUNIT_ASSERT( Integer::reverse( Integer::reverse( 255 ) ) == 255 );
+
+    // parseInt
+    CPPUNIT_ASSERT( Integer::parseInt( "255") == 255 );
+    CPPUNIT_ASSERT( Integer::parseInt( "255", 10 ) == 255 );
+    CPPUNIT_ASSERT( Integer::parseInt( "255", 11 ) != 255 );
+    CPPUNIT_ASSERT( Integer::parseInt( "FF", 16 ) == 255 );
+
+    // valueOf
+    CPPUNIT_ASSERT( Integer::valueOf( 255 ) == 255 );
+    CPPUNIT_ASSERT( Integer::valueOf( "255" ) == 255 );
+    CPPUNIT_ASSERT( Integer::valueOf( "255", 10 ) == 255 );
+    CPPUNIT_ASSERT( (Integer::valueOf( "255", 11 )).intValue() != 255 );
+    CPPUNIT_ASSERT( Integer::valueOf( "FF", 16 ) == 255 );
+
+    // bitCount
+    CPPUNIT_ASSERT( Integer::bitCount( 255 ) == 8 );
+    CPPUNIT_ASSERT( Integer::bitCount( 0xFFFFFFFF ) == 32 );
+
+    //toXXXString
+    CPPUNIT_ASSERT( Integer::toString( 255 ) == "255" );
+    CPPUNIT_ASSERT( Integer::toString( 255, 16 ) == "ff" );
+    CPPUNIT_ASSERT( Integer::toHexString( 255 ) == "ff" );
+    CPPUNIT_ASSERT( Integer::toOctalString( 255 ) == "377" );
+    CPPUNIT_ASSERT( Integer::toBinaryString( 255 ) == "11111111" );
+    CPPUNIT_ASSERT( Integer::toString( 255255 ) == "255255" );
+
+    // highestOneBit
+    CPPUNIT_ASSERT( Integer::highestOneBit( 255 ) == 128 );
+    CPPUNIT_ASSERT( Integer::highestOneBit( 0xFF000000 ) == (int)0x80000000 );
+
+    // lowestOneBit
+    CPPUNIT_ASSERT( Integer::lowestOneBit( 255 ) == 1 );
+    CPPUNIT_ASSERT( Integer::lowestOneBit( 0xFF000000 ) == (int)0x01000000 );
+}

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/IntegerTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,48 @@
+/*
+ * 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_INTEGERTEST_H_
+#define _DECAF_LANG_INTEGERTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/lang/Integer.h>
+
+namespace decaf{
+namespace lang{
+
+    class IntegerTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( IntegerTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST( test2 );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        IntegerTest(void) {}
+        virtual ~IntegerTest(void) {}
+
+        virtual void test();
+        virtual void test2();
+
+    };
+
+}}
+
+#endif /*_DECAF_LANG_INTEGERTEST_H_*/

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,110 @@
+/*
+ * 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 "LongTest.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+void LongTest::test() {
+
+    long long x = Long::parseLong("12");
+    long long y = Long::parseLong("FF", 16);
+    long long z = Long::parseLong("42");
+
+    CPPUNIT_ASSERT( x == 12 );
+    CPPUNIT_ASSERT( y == 255 );
+    CPPUNIT_ASSERT( z == 42 );
+
+    std::string x1 = Long::toString( x );
+    std::string y1 = Long::toString( y );
+    std::string z1 = Long::toString( z );
+
+    CPPUNIT_ASSERT( x1 == "12" );
+    CPPUNIT_ASSERT( y1 == "255" );
+    CPPUNIT_ASSERT( z1 == "42" );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LongTest::test2() {
+
+    Long llong( 255 );
+
+    // Test cast functions
+    CPPUNIT_ASSERT( llong.byteValue() == 255 );
+    CPPUNIT_ASSERT( llong.shortValue() ==  255 );
+    CPPUNIT_ASSERT( llong.intValue() == 255 );
+    CPPUNIT_ASSERT( llong.longValue() == 255 );
+    CPPUNIT_ASSERT( llong.floatValue() == 255.0f );
+    CPPUNIT_ASSERT( llong.doubleValue() == 255.0 );
+
+    // Comparison functions
+    CPPUNIT_ASSERT( llong.compareTo( 256 ) == -1 );
+    CPPUNIT_ASSERT( llong.compareTo( 255 ) == 0 );
+    CPPUNIT_ASSERT( llong.compareTo( 254 ) == 1 );
+    CPPUNIT_ASSERT( llong.equals( Long( 255 ) ) == true );
+    CPPUNIT_ASSERT( llong.compareTo( Long( 255 ) ) == 0 );
+    CPPUNIT_ASSERT( llong == Long( 255 ) );
+
+    // decode
+    CPPUNIT_ASSERT( llong == Long::decode( "255" ) );
+    CPPUNIT_ASSERT( llong == Long::decode( "0xFF" ) );
+    CPPUNIT_ASSERT( llong == Long::decode( "255" ) );
+    CPPUNIT_ASSERT( Long::decode( "-255" ) == -255 );
+
+    // reverseBytes
+    CPPUNIT_ASSERT( (long long)0xFF00000000000000LL == Long::reverseBytes( 255 ) );
+
+    // reverse
+    CPPUNIT_ASSERT( Long::reverse( Long::reverse( 255 ) ) == 255 );
+
+    // parseInt
+    CPPUNIT_ASSERT( Long::parseLong( "255") == 255 );
+    CPPUNIT_ASSERT( Long::parseLong( "255", 10 ) == 255 );
+    CPPUNIT_ASSERT( Long::parseLong( "255", 11 ) != 255 );
+    CPPUNIT_ASSERT( Long::parseLong( "FF", 16 ) == 255 );
+
+    // valueOf
+    CPPUNIT_ASSERT( Long::valueOf( 255 ) == 255 );
+    CPPUNIT_ASSERT( Long::valueOf( "255" ) == 255 );
+    CPPUNIT_ASSERT( Long::valueOf( "255", 10 ) == 255 );
+    CPPUNIT_ASSERT( (Long::valueOf( "255", 11 )).intValue() != 255 );
+    CPPUNIT_ASSERT( Long::valueOf( "FF", 16 ) == 255 );
+
+    // bitCount
+    CPPUNIT_ASSERT( Long::bitCount( 255 ) == 8 );
+    CPPUNIT_ASSERT( Long::bitCount( 0xFFFFFFFF ) == 32 );
+
+    //toXXXString
+    CPPUNIT_ASSERT( Long::toString( 255 ) == "255" );
+    CPPUNIT_ASSERT( Long::toString( 255, 16 ) == "ff" );
+    CPPUNIT_ASSERT( Long::toHexString( 255 ) == "ff" );
+    CPPUNIT_ASSERT( Long::toOctalString( 255 ) == "377" );
+    CPPUNIT_ASSERT( Long::toBinaryString( 255 ) == "11111111" );
+    CPPUNIT_ASSERT( Long::toString( 255255 ) == "255255" );
+
+    // highestOneBit
+    CPPUNIT_ASSERT( Long::highestOneBit( 255 ) == 128 );
+    CPPUNIT_ASSERT( Long::highestOneBit( 0xFF000000 ) == (long long)0x80000000 );
+
+    // lowestOneBit
+    CPPUNIT_ASSERT( Long::lowestOneBit( 255 ) == 1 );
+    CPPUNIT_ASSERT( Long::lowestOneBit( 0xFF000000 ) == (long long)0x01000000 );
+
+}

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/LongTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,48 @@
+/*
+ * 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_LONGTEST_H_
+#define _DECAF_LANG_LONGTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/lang/Long.h>
+
+namespace decaf{
+namespace lang{
+
+    class LongTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( LongTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST( test2 );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        LongTest() {}
+        virtual ~LongTest() {}
+
+        virtual void test();
+        virtual void test2();
+
+    };
+
+}}
+
+#endif /*_DECAF_LANG_LONGTEST_H_*/

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,701 @@
+/*
+ * 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 "MathTest.h"
+
+#include <decaf/lang/Math.h>
+#include <decaf/lang/Double.h>
+#include <decaf/lang/Float.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+MathTest::MathTest() {
+    this->HYP = Math::sqrt( 2.0 );
+    this->OPP = 1.0;
+    this->ADJ = 1.0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_absD() {
+    // Test for method double decaf.lang.Math.abs(double)
+
+    CPPUNIT_ASSERT_MESSAGE( "Incorrect double abs value",
+            ( Math::abs(-1908.8976) == 1908.8976));
+    CPPUNIT_ASSERT_MESSAGE( "Incorrect double abs value",
+            ( Math::abs(1908.8976) == 1908.8976));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_absF() {
+    // Test for method float decaf.lang.Math::abs(float)
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float abs value",
+            (Math::abs(-1908.8976f) == 1908.8976f));
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float abs value",
+            (Math::abs(1908.8976f) == 1908.8976f));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_absI() {
+    // Test for method int decaf.lang.Math::abs(int)
+    CPPUNIT_ASSERT_MESSAGE("Incorrect int abs value", (Math::abs(-1908897) == 1908897));
+    CPPUNIT_ASSERT_MESSAGE("Incorrect int abs value", (Math::abs(1908897) == 1908897));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_absJ() {
+    // Test for method long decaf.lang.Math::abs(long)
+    CPPUNIT_ASSERT_MESSAGE("Incorrect long abs value",
+            (Math::abs(-19088976000089LL) == 19088976000089LL));
+    CPPUNIT_ASSERT_MESSAGE("Incorrect long abs value",
+            (Math::abs(19088976000089LL) == 19088976000089LL));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_acosD() {
+    // Test for method double decaf.lang.Math::acos(double)
+    double r = Math::cos(Math::acos(ADJ / HYP));
+    long long lr = Double::doubleToLongBits(r);
+    long long t = Double::doubleToLongBits(ADJ / HYP);
+    CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc cosine", lr == t || (lr + 1) == t
+            || (lr - 1) == t);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_asinD() {
+    // Test for method double decaf.lang.Math::asin(double)
+    double r = Math::sin(Math::asin(OPP / HYP));
+    long long lr = Double::doubleToLongBits(r);
+    long long t = Double::doubleToLongBits(OPP / HYP);
+    CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc sine", lr == t || (lr + 1) == t
+            || (lr - 1) == t);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_atanD() {
+    // Test for method double decaf.lang.Math::atan(double)
+    double answer = Math::tan(Math::atan(1.0));
+    CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc tangent: ",
+            answer <= 1.0 && answer >= 9.9999999999999983E-1);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_atan2DD() {
+    // Test for method double decaf.lang.Math::atan2(double, double)
+    double answer = Math::atan(Math::tan(1.0));
+    CPPUNIT_ASSERT_MESSAGE("Returned incorrect arc tangent: ",
+            answer <= 1.0 && answer >= 9.9999999999999983E-1);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_cbrt_D() {
+    //Test for special situations
+#ifndef _WIN32
+    CPPUNIT_ASSERT_MESSAGE("Should return Double::NaN",
+            Double::isNaN(Math::cbrt(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::POSITIVE_INFINITY",
+            Math::cbrt(Double::POSITIVE_INFINITY), Double::POSITIVE_INFINITY );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::NEGATIVE_INFINITY",
+            Math::cbrt(Double::NEGATIVE_INFINITY), Double::NEGATIVE_INFINITY);
+    CPPUNIT_ASSERT_EQUAL(
+            Double::doubleToLongBits(0.0),
+            Double::doubleToLongBits(Math::cbrt(0.0)));
+    CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(+0.0),
+                          Double::doubleToLongBits(Math::cbrt(+0.0)));
+    CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(-0.0),
+                          Double::doubleToLongBits(Math::cbrt(-0.0)));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 3.0", Math::cbrt(27.0), 3.0);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5.643803094122362E102",
+            5.643803094122362E102, Math::cbrt(Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 0.01", 0.01, Math::cbrt(0.000001));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -3.0", -3.0, Math::cbrt(-27.0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.7031839360032603E-108",
+            1.7031839360032603E-108, Math::cbrt(Double::MIN_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -0.01", -0.01, Math::cbrt(-0.000001));
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_ceilD() {
+    // Test for method double decaf.lang.Math::ceil(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Incorrect ceiling for double",
+                                  79.0, Math::ceil(78.89) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect ceiling for double",
+                         -78.0, Math::ceil(-78.89) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_cosD() {
+    // Test for method double decaf.lang.Math::cos(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer", 1.0, Math::cos(0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer", 0.5403023058681398, Math::cos(1));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_cosh_D() {
+    // Test for special situations
+    CPPUNIT_ASSERT(Double::isNaN(Math::cosh(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::cosh(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::cosh(Double::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0", 1.0, Math::cosh(+0.0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0", 1.0, Math::cosh(-0.0));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::cosh(1234.56));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::cosh(-1234.56));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0000000000005",
+            1.0000000000005, Math::cosh(0.000001));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0000000000005",
+            1.0000000000005, Math::cosh(-0.000001));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5.212214351945598",
+            5.212214351945598, Math::cosh(2.33482));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::cosh(Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0",
+            1.0, Math::cosh(Double::MIN_VALUE));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_expD() {
+    // Test for method double decaf.lang.Math::exp(double)
+    CPPUNIT_ASSERT_MESSAGE("Incorrect answer returned for simple power",
+            Math::abs(Math::exp(4.0) -
+            Math::E * Math::E * Math::E * Math::E) < 0.1 );
+    CPPUNIT_ASSERT_MESSAGE("Incorrect answer returned for larger power",
+            Math::log( Math::abs( Math::exp(5.5) ) - 5.5) < 10.0 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_expm1_D() {
+
+#ifndef _WIN32
+    // Test for special cases
+    CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::expm1(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::expm1(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0", -1.0,
+            Math::expm1(Double::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(0.0),
+                          Double::doubleToLongBits(Math::expm1(0.0)) );
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
+            Double::doubleToLongBits(Math::expm1(+0.0)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
+            Double::doubleToLongBits(Math::expm1(-0.0)));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -9.999950000166666E-6",
+            -9.999950000166666E-6, Math::expm1(-0.00001));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0145103074469635E60",
+            1.0145103074469635E60, Math::expm1(138.16951162));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY,
+            Math::expm1(123456789123456789123456789.4521584223));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::expm1(Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return MIN_VALUE", Double::MIN_VALUE,
+            Math::expm1(Double::MIN_VALUE));
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_floorD() {
+    // Test for method double decaf.lang.Math::floor(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect floor for double",
+                         78.0, Math::floor(78.89));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect floor for double",
+                         -79.0, Math::floor(-78.89));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_hypot_DD() {
+    // Test for special cases
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::hypot(Double::POSITIVE_INFINITY,
+                    1.0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::hypot(Double::NEGATIVE_INFINITY,
+                    123.324));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY,
+            Math::hypot(-758.2587,Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY,
+            Math::hypot(5687.21, Double::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::hypot(Double::POSITIVE_INFINITY,
+                    Double::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::hypot(Double::NEGATIVE_INFINITY,
+                    Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_MESSAGE("Should be NaN", Double::isNaN(Math::hypot(Double::NaN,
+            2342301.89843)));
+    CPPUNIT_ASSERT_MESSAGE("Should be NaN", Double::isNaN(Math::hypot(-345.2680,
+            Double::NaN)));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 2396424.905416697",
+            2396424.905416697, Math::hypot(12322.12, -2396393.2258));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 138.16958070558556", 138.16958070558556,
+            Math::hypot(-138.16951162, 0.13817035864));
+#ifndef _WIN32
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.7976931348623157E308",
+            1.7976931348623157E308, Math::hypot(Double::MAX_VALUE, 211370.35));
+#endif
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5413.7185", 5413.7185, Math::hypot(
+            -5413.7185, Double::MIN_VALUE));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_IEEEremainderDD() {
+#ifndef _WIN32
+    // Test for method double decaf.lang.Math::IEEEremainder(double, double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect remainder returned",
+            0.0, Math::IEEEremainder(1.0, 1.0));
+    CPPUNIT_ASSERT_MESSAGE("Incorrect remainder returned",
+            Math::IEEEremainder(1.32,89.765) >= 1.4705063220631647E-2 ||
+            Math::IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_logD() {
+    // Test for method double decaf.lang.Math::log(double)
+    for( double d = 10; d >= -10; d -= 0.5 ) {
+        double answer = Math::log( Math::exp(d) );
+
+        CPPUNIT_ASSERT_MESSAGE(
+                "Answer does not equal expected answer for d",
+                Math::abs( answer - d ) <= Math::abs(d * 0.00000001) );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_log10_D() {
+    // Test for special cases
+    CPPUNIT_ASSERT(Double::isNaN(Math::log10(Double::NaN)));
+    CPPUNIT_ASSERT(Double::isNaN(Math::log10(-2541.05745687234187532)));
+    CPPUNIT_ASSERT(Double::isNaN(Math::log10(-0.1)));
+    CPPUNIT_ASSERT_EQUAL(Double::POSITIVE_INFINITY, Math::log10(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL(Double::NEGATIVE_INFINITY, Math::log10(0.0));
+    CPPUNIT_ASSERT_EQUAL(Double::NEGATIVE_INFINITY, Math::log10(+0.0));
+    CPPUNIT_ASSERT_EQUAL(Double::NEGATIVE_INFINITY, Math::log10(-0.0));
+
+    CPPUNIT_ASSERT_EQUAL(3.0, Math::log10(1000.0));
+    CPPUNIT_ASSERT_EQUAL(14.0, Math::log10(Math::pow(10, 14)));
+    
+    CPPUNIT_ASSERT_EQUAL(3738956126954LL, (long long)(Math::log10(5482.2158)*1000000000000.0));
+    CPPUNIT_ASSERT_EQUAL(14661551142893LL, (long long)(Math::log10(458723662312872.125782332587)*1000000000000.0));
+    CPPUNIT_ASSERT_EQUAL(-908382862219LL, (long long)(Math::log10(0.12348583358871)*1000000000000.0));
+    CPPUNIT_ASSERT_EQUAL(308254715559916LL, (long long)(Math::log10(Double::MAX_VALUE)*1000000000000.0));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_log1p_D() {
+#ifndef _WIN32
+    // Test for special cases
+    CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::log1p(Double::NaN)));
+    CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::log1p(-32.0482175)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::log1p(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(0.0),
+                          Double::doubleToLongBits(Math::log1p(0.0)));
+    CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(+0.0),
+                          Double::doubleToLongBits(Math::log1p(+0.0)));
+    CPPUNIT_ASSERT_EQUAL( Double::doubleToLongBits(-0.0),
+                          Double::doubleToLongBits(Math::log1p(-0.0)));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -0.2941782295312541", -0.2941782295312541,
+            Math::log1p(-0.254856327));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 7.368050685564151", 7.368050685564151,
+            Math::log1p(1583.542));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 0.4633708685409921", 0.4633708685409921,
+            Math::log1p(0.5894227));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 709.782712893384", 709.782712893384,
+            Math::log1p(Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::MIN_VALUE", Double::MIN_VALUE,
+            Math::log1p(Double::MIN_VALUE));
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_maxDD() {
+    // Test for method double decaf.lang.Math::max(double, double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double max value", 1908897.6000089,
+            Math::max(-1908897.6000089, 1908897.6000089));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double max value",
+            1908897.6000089, Math::max(2.0, 1908897.6000089));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double max value", -2.0,
+            Math::max(-2.0, -1908897.6000089));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_maxFF() {
+    // Test for method float decaf.lang.Math::max(float, float)
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float max value", Math::max(-1908897.600f,
+            1908897.600f) == 1908897.600f);
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float max value",
+            Math::max(2.0f, 1908897.600f) == 1908897.600f);
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float max value",
+            Math::max(-2.0f, -1908897.600f) == -2.0f);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_maxII() {
+    // Test for method int decaf.lang.Math::max(int, int)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int max value",
+            19088976, Math::max(-19088976, 19088976));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int max value",
+            19088976, Math::max(20, 19088976));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int max value", -20, Math::max(-20, -19088976));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_maxJJ() {
+    // Test for method long long decaf.lang.Math::max(long long, long long)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long max value",
+            19088976000089LL, Math::max(-19088976000089LL, 19088976000089LL));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long max value",
+            19088976000089LL, Math::max(20LL, 19088976000089LL));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long max value",
+            -20LL, Math::max(-20LL, -19088976000089LL));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_minDD() {
+    // Test for method double decaf.lang.Math::min(double, double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double min value",
+            -1908897.6000089, Math::min(-1908897.6000089, 1908897.6000089));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double min value",
+            2.0, Math::min(2.0, 1908897.6000089));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect double min value",
+            -1908897.6000089, Math::min(-2.0,-1908897.6000089));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_minFF() {
+    // Test for method float decaf.lang.Math::min(float, float)
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float min value", Math::min(-1908897.600f,
+            1908897.600f) == -1908897.600f);
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float min value",
+            Math::min(2.0f, 1908897.600f) == 2.0f);
+    CPPUNIT_ASSERT_MESSAGE("Incorrect float min value",
+            Math::min(-2.0f, -1908897.600f) == -1908897.600f);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_minII() {
+    // Test for method int decaf.lang.Math::min(int, int)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int min value",
+            -19088976, Math::min(-19088976, 19088976));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int min value", 20, Math::min(20, 19088976));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect int min value",
+            -19088976, Math::min(-20, -19088976));
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_minJJ() {
+    // Test for method long long decaf.lang.Math::min(long long, long long)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long min value",
+            -19088976000089LL, Math::min(-19088976000089LL, 19088976000089LL));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long min value",
+            20LL, Math::min(20LL, 19088976000089LL));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect long min value",
+            -19088976000089LL, Math::min(-20LL, -19088976000089LL));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_powDD() {
+    // Test for method double decaf.lang.Math::pow(double, double)
+    CPPUNIT_ASSERT_MESSAGE("pow returned incorrect value",
+            (long) Math::pow(2, 8) == 256l);
+    CPPUNIT_ASSERT_MESSAGE("pow returned incorrect value",
+            Math::pow(2, -8) == 0.00390625);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect root returned1",
+                         2, (int)Math::sqrt(Math::pow(Math::sqrt(2), 4)));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_rintD() {
+#ifndef _WIN32
+    // Test for method double decaf.lang.Math::rint(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to round properly - up to odd",
+            3.0, Math::rint(2.9));
+    CPPUNIT_ASSERT_MESSAGE("Failed to round properly - NaN",
+            Double::isNaN(Math::rint(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to round properly down to even",
+            2.0, Math::rint(2.1));
+    CPPUNIT_ASSERT_MESSAGE("Failed to round properly to even",
+            Math::rint(2.5) == 2.0);
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_roundD() {
+    // Test for method long decaf.lang.Math::round(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect rounding of a float",
+            -91LL, Math::round(-90.89));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_roundF() {
+    // Test for method int decaf.lang.Math::round(float)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect rounding of a float",
+            -91, Math::round(-90.89f));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_signum_D() {
+    CPPUNIT_ASSERT(Double::isNaN(Math::signum(Double::NaN)));
+    CPPUNIT_ASSERT(Double::isNaN(Math::signum(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(0.0),
+            Double::doubleToLongBits(Math::signum(0.0)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
+            Double::doubleToLongBits(Math::signum(+0.0)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
+            Double::doubleToLongBits(Math::signum(-0.0)));
+
+    CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(253681.2187962));
+    CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-125874693.56));
+    CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(1.2587E-308));
+    CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-1.2587E-308));
+
+    CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(Double::MIN_VALUE));
+    CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(-Double::MIN_VALUE));
+    CPPUNIT_ASSERT_EQUAL(1.0, Math::signum(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL(-1.0, Math::signum(Double::NEGATIVE_INFINITY));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_signum_F() {
+    CPPUNIT_ASSERT(Float::isNaN(Math::signum(Float::NaN)));
+    CPPUNIT_ASSERT_EQUAL(Float::floatToIntBits(0.0f),
+            Float::floatToIntBits(Math::signum(0.0f)));
+    CPPUNIT_ASSERT_EQUAL(Float::floatToIntBits(+0.0f),
+            Float::floatToIntBits(Math::signum(+0.0f)));
+    CPPUNIT_ASSERT_EQUAL(Float::floatToIntBits(-0.0f),
+            Float::floatToIntBits(Math::signum(-0.0f)));
+
+    CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(253681.2187962f));
+    CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-125874693.56f));
+    CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(1.2587E-11f));
+    CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-1.2587E-11f));
+
+    CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(Float::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(Float::MIN_VALUE));
+    CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-Float::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(-Float::MIN_VALUE));
+    CPPUNIT_ASSERT_EQUAL(1.0f, Math::signum(Float::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL(-1.0f, Math::signum(Float::NEGATIVE_INFINITY));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_sinD() {
+    // Test for method double decaf.lang.Math::sin(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
+        0.0, Math::sin(0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
+        0.8414709848078965, Math::sin(1));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_sinh_D() {
+    // Test for special situations
+    CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::sinh(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::sinh(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return NEGATIVE_INFINITY",
+            Double::NEGATIVE_INFINITY, Math::sinh(Double::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(0.0),
+            Double::doubleToLongBits(Math::sinh(0.0)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
+            Double::doubleToLongBits(Math::sinh(+0.0)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
+            Double::doubleToLongBits(Math::sinh(-0.0)));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::sinh(1234.56));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return NEGATIVE_INFINITY",
+            Double::NEGATIVE_INFINITY, Math::sinh(-1234.56));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0000000000001666E-6",
+            1.0000000000001666E-6, Math::sinh(0.000001));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0000000000001666E-6",
+            -1.0000000000001666E-6, Math::sinh(-0.000001));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5.11538644196386",
+             5.11538644196386, Math::sinh( 2.33482 ) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
+            Double::POSITIVE_INFINITY, Math::sinh(Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 4.9E-324", 4.9E-324,
+            Math::sinh(Double::MIN_VALUE));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_sqrtD() {
+    // Test for method double decaf.lang.Math::sqrt(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(
+        "Incorrect root returned2", 7.0, Math::sqrt(49.0) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_tanD() {
+    // Test for method double decaf.lang.Math::tan(double)
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
+            0.0, Math::tan(0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect answer",
+            1.5574077246549023, Math::tan(1));
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_tanh_D() {
+    // Test for special situations
+    CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::tanh(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return +1.0", +1.0,
+            Math::tanh(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0", -1.0,
+            Math::tanh(Double::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(0.0),
+            Double::doubleToLongBits(Math::tanh(0.0)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(+0.0),
+            Double::doubleToLongBits(Math::tanh(+0.0)));
+    CPPUNIT_ASSERT_EQUAL(Double::doubleToLongBits(-0.0),
+            Double::doubleToLongBits(Math::tanh(-0.0)));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0", 1.0, Math::tanh(1234.56));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -1.0", -1.0, Math::tanh(-1234.56));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 9.999999999996666E-7",
+            9.999999999996666E-7, Math::tanh(0.000001));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 0.981422884124941", 0.981422884124941,
+            Math::tanh(2.33482));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.0",
+            1.0, Math::tanh(Double::MAX_VALUE));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 4.9E-324", 4.9E-324,
+            Math::tanh(Double::MIN_VALUE));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_random() {
+    // There isn't a place for these tests so just stick them here
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong value E",
+        4613303445314885481LL, Double::doubleToLongBits(Math::E));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong value PI",
+        4614256656552045848LL, Double::doubleToLongBits(Math::PI));
+
+    for (int i = 500; i >= 0; i--) {
+        double d = Math::random();
+        CPPUNIT_ASSERT_MESSAGE("Generated number is out of range: ",
+                d >= 0.0 && d < 1.0);
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_toRadiansD() {
+    for (double d = 500; d >= 0; d -= 1.0) {
+        double converted = Math::toDegrees(Math::toRadians(d));
+        CPPUNIT_ASSERT_MESSAGE("Converted number not equal to original. d ",
+                converted >= d * 0.99999999 && converted <= d * 1.00000001);
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_toDegreesD() {
+    for (double d = 500; d >= 0; d -= 1.0) {
+        double converted = Math::toRadians(Math::toDegrees(d));
+        CPPUNIT_ASSERT_MESSAGE("Converted number not equal to original. d ",
+                converted >= d * 0.99999999 && converted <= d * 1.00000001);
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_ulp_D() {
+#ifndef _WIN32
+    // Test for special cases
+    CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::ulp(Double::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::POSITIVE_INFINITY,
+            Math::ulp(Double::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::POSITIVE_INFINITY,
+            Math::ulp(Double::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            Double::MIN_VALUE, Math::ulp(0.0) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::MIN_VALUE,
+            Math::ulp(+0.0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::MIN_VALUE,
+            Math::ulp(-0.0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Math::pow(2, 971),
+            Math::ulp(Double::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Math::pow(2, 971),
+            Math::ulp(-Double::MAX_VALUE));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            Double::MIN_VALUE, Math::ulp(Double::MIN_VALUE) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            Double::MIN_VALUE, Math::ulp(-Double::MIN_VALUE) );
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 2.220446049250313E-16,
+            Math::ulp(1.0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 2.220446049250313E-16,
+            Math::ulp(-1.0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 2.2737367544323206E-13,
+            Math::ulp(1153.0));
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_ulp_f() {
+#ifndef _WIN32
+    // Test for special cases
+    CPPUNIT_ASSERT_MESSAGE("Should return NaN", Float::isNaN(Math::ulp(Float::NaN)));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            Float::POSITIVE_INFINITY, Math::ulp(Float::POSITIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            Float::POSITIVE_INFINITY, Math::ulp(Float::NEGATIVE_INFINITY));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            Float::MIN_VALUE, Math::ulp(0.0f));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Float::MIN_VALUE, Math
+            ::ulp(+0.0f));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            Math::ulp(-0.0f), Float::MIN_VALUE );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            2.028241E31f, Math::ulp(Float::MAX_VALUE));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            2.028241E31f, Math::ulp(-Float::MAX_VALUE));
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            1.4E-45f, Math::ulp( Float::MIN_VALUE ) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            1.4E-45f, Math::ulp( -Float::MIN_VALUE ) );
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            1.1920929E-7f, Math::ulp(1.0f));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 1.1920929E-7f,
+            Math::ulp(-1.0f));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            1.2207031E-4f, Math::ulp(1153.0f));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
+            5.6E-45f, Math::ulp(9.403954E-38f) );
+#endif
+}
+

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/MathTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,136 @@
+/*
+ * 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_MATHTEST_H_
+#define _DECAF_LANG_MATHTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf{
+namespace lang{
+
+    class MathTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( MathTest );
+        CPPUNIT_TEST( test_absD );
+        CPPUNIT_TEST( test_absF );
+        CPPUNIT_TEST( test_absI );
+        CPPUNIT_TEST( test_absJ );
+        CPPUNIT_TEST( test_acosD );
+        CPPUNIT_TEST( test_asinD );
+        CPPUNIT_TEST( test_atanD );
+        CPPUNIT_TEST( test_atan2DD );
+        CPPUNIT_TEST( test_cbrt_D );
+        CPPUNIT_TEST( test_ceilD );
+        CPPUNIT_TEST( test_cosD );
+        CPPUNIT_TEST( test_cosh_D );
+        CPPUNIT_TEST( test_expD );
+        CPPUNIT_TEST( test_expm1_D );
+        CPPUNIT_TEST( test_floorD );
+        CPPUNIT_TEST( test_hypot_DD );
+        CPPUNIT_TEST( test_IEEEremainderDD );
+        CPPUNIT_TEST( test_logD );
+        CPPUNIT_TEST( test_log10_D );
+        CPPUNIT_TEST( test_log1p_D );
+        CPPUNIT_TEST( test_maxDD );
+        CPPUNIT_TEST( test_maxFF );
+        CPPUNIT_TEST( test_maxII );
+        CPPUNIT_TEST( test_maxJJ );
+        CPPUNIT_TEST( test_minDD );
+        CPPUNIT_TEST( test_minFF );
+        CPPUNIT_TEST( test_minII );
+        CPPUNIT_TEST( test_minJJ );
+        CPPUNIT_TEST( test_powDD );
+        CPPUNIT_TEST( test_rintD );
+        CPPUNIT_TEST( test_roundD );
+        CPPUNIT_TEST( test_roundF );
+        CPPUNIT_TEST( test_signum_D );
+        CPPUNIT_TEST( test_signum_F );
+        CPPUNIT_TEST( test_sinD );
+        CPPUNIT_TEST( test_sinh_D );
+        CPPUNIT_TEST( test_sqrtD );
+        CPPUNIT_TEST( test_tanD );
+        CPPUNIT_TEST( test_tanh_D );
+        CPPUNIT_TEST( test_random );
+        CPPUNIT_TEST( test_toRadiansD );
+        CPPUNIT_TEST( test_toDegreesD );
+        CPPUNIT_TEST( test_ulp_D );
+        CPPUNIT_TEST( test_ulp_f );
+        CPPUNIT_TEST_SUITE_END();
+
+    private:
+
+        double HYP;
+        double OPP;
+        double ADJ;
+
+    public:
+
+        MathTest();
+        virtual ~MathTest() {}
+
+        virtual void test_absD();
+        virtual void test_absF();
+        virtual void test_absI();
+        virtual void test_absJ();
+        virtual void test_acosD();
+        virtual void test_asinD();
+        virtual void test_atanD();
+        virtual void test_atan2DD();
+        virtual void test_cbrt_D();
+        virtual void test_ceilD();
+        virtual void test_cosD();
+        virtual void test_cosh_D();
+        virtual void test_expD();
+        virtual void test_expm1_D();
+        virtual void test_floorD();
+        virtual void test_hypot_DD();
+        virtual void test_IEEEremainderDD();
+        virtual void test_logD();
+        virtual void test_log10_D();
+        virtual void test_log1p_D();
+        virtual void test_maxDD();
+        virtual void test_maxFF();
+        virtual void test_maxII();
+        virtual void test_maxJJ();
+        virtual void test_minDD();
+        virtual void test_minFF();
+        virtual void test_minII();
+        virtual void test_minJJ();
+        virtual void test_powDD();
+        virtual void test_rintD();
+        virtual void test_roundD();
+        virtual void test_roundF();
+        virtual void test_signum_D();
+        virtual void test_signum_F();
+        virtual void test_sinD();
+        virtual void test_sinh_D();
+        virtual void test_sqrtD();
+        virtual void test_tanD();
+        virtual void test_tanh_D();
+        virtual void test_random();
+        virtual void test_toRadiansD();
+        virtual void test_toDegreesD();
+        virtual void test_ulp_D();
+        virtual void test_ulp_f();
+
+    };
+
+}}
+
+#endif /*_DECAF_LANG_MATHTEST_H_*/

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,80 @@
+/*
+ * 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 "ShortTest.h"
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+ShortTest::ShortTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ShortTest::test() {
+
+    Short short1( 65 );
+
+    CPPUNIT_ASSERT( short1.byteValue() == 65 );
+    CPPUNIT_ASSERT( short1.shortValue() == 65 );
+    CPPUNIT_ASSERT( short1.intValue() == 65 );
+    CPPUNIT_ASSERT( short1.longValue() == 65 );
+    CPPUNIT_ASSERT( short1.floatValue() == 65.0f );
+    CPPUNIT_ASSERT( short1.doubleValue() == 65.0 );
+
+    CPPUNIT_ASSERT( short1.toString() == "65" );
+    CPPUNIT_ASSERT( short1.toString( 99 ) == "99" );
+
+    CPPUNIT_ASSERT( Short::reverseBytes( (short)0xFF00 ) == (short)0x00FF );
+    CPPUNIT_ASSERT( Short::reverseBytes( (short)0x0F00 ) == (short)0x000F );
+    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" );
+
+}
+

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/ShortTest.h Tue Apr 29 13:52:30 2008
@@ -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_SHORTTEST_H_
+#define _DECAF_LANG_SHORTTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <decaf/lang/Short.h>
+
+namespace decaf{
+namespace lang{
+
+    class ShortTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( ShortTest );
+        CPPUNIT_TEST( test );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        ShortTest();
+        virtual ~ShortTest() {}
+
+        void test();
+
+    };
+
+}}
+
+#endif /*_DECAF_LANG_SHORTTEST_H_*/

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,81 @@
+/*
+ * 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 "SystemTest.h"
+
+#include <decaf/lang/System.h>
+#include <decaf/util/Map.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+SystemTest::SystemTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SystemTest::test_getenv() {
+
+    CPPUNIT_ASSERT( System::getenv( "PATH" ) != "" );
+
+    try {
+        System::getenv( "PATH_ASDFGHJKL" );
+        CPPUNIT_ASSERT( false );
+    } catch (...) {
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SystemTest::test_getenv2() {
+
+    Map<std::string, std::string> values = System::getenv();
+
+    CPPUNIT_ASSERT( values.size() != 0 );
+    CPPUNIT_ASSERT( values.containsKey( "PATH" ) || values.containsKey( "Path" ) );
+    CPPUNIT_ASSERT( !values.containsKey( "PATH_ASDFGHJKL" ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SystemTest::test_setenv() {
+
+    Map<std::string, std::string> values1 = System::getenv();
+    CPPUNIT_ASSERT( !values1.containsKey( "PATH_ASDFGHJKL" ) );
+    System::setenv( "PATH_ASDFGHJKL", "test" );
+    Map<std::string, std::string> values2 = System::getenv();
+    CPPUNIT_ASSERT( values2.containsKey( "PATH_ASDFGHJKL" ) );
+    System::unsetenv( "PATH_ASDFGHJKL" );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SystemTest::test_unsetenv() {
+
+    Map<std::string, std::string> values1 = System::getenv();
+    CPPUNIT_ASSERT( !values1.containsKey( "PATH_ASDFGHJKL" ) );
+    System::setenv( "PATH_ASDFGHJKL", "test" );
+    Map<std::string, std::string> values2 = System::getenv();
+    CPPUNIT_ASSERT( values2.containsKey( "PATH_ASDFGHJKL" ) );
+    System::unsetenv( "PATH_ASDFGHJKL" );
+    Map<std::string, std::string> values3 = System::getenv();
+    CPPUNIT_ASSERT( !values3.containsKey( "PATH_ASDFGHJKL" ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SystemTest::test_currentTimeMillis() {
+    CPPUNIT_ASSERT( System::currentTimeMillis() != 0 );
+}

Added: activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.h (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,52 @@
+/*
+ * 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_SYSTEMTEST_H_
+#define _DECAF_LANG_SYSTEMTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf{
+namespace lang{
+
+    class SystemTest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( SystemTest );
+        CPPUNIT_TEST( test_getenv );
+        CPPUNIT_TEST( test_getenv2 );
+        CPPUNIT_TEST( test_setenv );
+        CPPUNIT_TEST( test_unsetenv );
+        CPPUNIT_TEST( test_currentTimeMillis );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        SystemTest();
+        virtual ~SystemTest() {}
+
+        void test_getenv();
+        void test_getenv2();
+        void test_setenv();
+        void test_unsetenv();
+        void test_currentTimeMillis();
+
+    };
+
+}}
+
+#endif /*_DECAF_LANG_SYSTEMTEST_H_*/