activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r563955 - in /activemq/activemq-cpp/trunk/src/decaf/src: main/decaf/lang/Math.cpp test/decaf/lang/MathTest.cpp test/decaf/lang/MathTest.h
Date Wed, 08 Aug 2007 17:44:31 GMT
Author: tabish
Date: Wed Aug  8 10:44:28 2007
New Revision: 563955

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

Implementing more of the Math functions

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp?view=diff&rev=563955&r1=563954&r2=563955
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp Wed Aug  8 10:44:28
2007
@@ -73,9 +73,13 @@
 
     if( Double::isNaN( value ) ) {
         return Double::NaN;
+    } else if( Double::isInfinite( value ) ) {
+        return value;
+    } else if( !( value < 0 || value > 0 ) ) {
+        return value;
     }
 
-    return cbrt( value );
+    return ::cbrt( value );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -120,7 +124,7 @@
     if( Double::isNaN( value ) ) {
         return Double::NaN;
     } else if( Double::isInfinite( value ) ) {
-        return Double::POSITIVE_INFINITY;
+        return value;
     } else if( value == 0.0 || value == -0.0 ) {
         return value;
     }
@@ -143,13 +147,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 double Math::tanh( double value ) {
 
-    if( Double::isNaN( value ) || value < -1.0 ) {
+    if( Double::isNaN( value ) ) {
         return Double::NaN;
     } else if( value == Double::POSITIVE_INFINITY ) {
         return 1.0;
     } else if( value == Double::NEGATIVE_INFINITY ) {
         return -1.0;
-    } else if( value == 0.0 || value == -0.0 ) {
+    } else if( !( value < 0 || value > 0 ) ) {
         return value;
     }
 
@@ -179,7 +183,7 @@
         return value;
     }
 
-    return rint( value );
+    return ::rint( value );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -205,12 +209,11 @@
         return Double::POSITIVE_INFINITY;
     } else if( value == Double::NEGATIVE_INFINITY ) {
         return -1.0;
-    } else if( value > 0 || value < 0 ) {
-        return expm1( value );
+    } else if( !( value > 0 || value < 0 ) ) {
+        return value;
     }
 
-    // +-0.0
-    return value;
+    return ::expm1( value );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -323,11 +326,11 @@
 ////////////////////////////////////////////////////////////////////////////////
 double Math::log10( double value ) {
 
-    if( Double::isNaN( value ) || value < 0.0 ) {
+    if( Double::isNaN( value ) || value < 0 ) {
         return Double::NaN;
     } else if( value == Double::POSITIVE_INFINITY ) {
         return Double::POSITIVE_INFINITY;
-    } else if( value == 0.0 || value == -0.0 ) {
+    } else if( !( value < 0 || value > 0 ) ) {
         return Double::NEGATIVE_INFINITY;
     }
 
@@ -347,7 +350,7 @@
         return value;
     }
 
-    return log1p( value );
+    return ::log1p( value );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -355,9 +358,9 @@
 
     if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
         return value;
-    } else if( value == 0.0 || value == -0.0 ) {
+    } else if( !( value < 0 || value > 0 ) ) {
         return value;
-    } else if( -1.0 <= value <= 0.0 ) {
+    } else if( value > -1.0 && value < 0.0 ) {
         return -0.0;
     }
 
@@ -407,7 +410,7 @@
         return f1;
     }
 
-    return remainder( f1, f2 );
+    return ::remainder( f1, f2 );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -447,7 +450,7 @@
         return Double::NaN;
     }
 
-    return hypot( x, y );
+    return ::hypot( x, y );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -473,10 +476,12 @@
         return Float::POSITIVE_INFINITY;
     } else if( value == Float::MAX_VALUE || value == -Float::MAX_VALUE ) {
         return (float)pow( 2, 104 );
+    } else if( !( value < 0 || value > 0 ) ) {
+        return Float::MIN_VALUE;
     }
 
     value = abs( value );
-    return nextafterf( value, Float::MAX_VALUE ) - value;
+    return ::nextafterf( value, Float::MAX_VALUE ) - value;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -488,8 +493,10 @@
         return Double::POSITIVE_INFINITY;
     } else if( value == Double::MAX_VALUE || value == -Double::MAX_VALUE ) {
         return pow( 2, 971 );
+    } else if( !( value < 0 || value > 0 ) ) {
+        return Double::MIN_VALUE;
     }
 
     value = abs( value );
-    return nextafterf( value, Double::MAX_VALUE ) - value;
+    return ::nextafterf( value, Double::MAX_VALUE ) - value;
 }

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.cpp?view=diff&rev=563955&r1=563954&r2=563955
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.cpp Wed Aug  8 10:44:28
2007
@@ -18,6 +18,8 @@
 #include "MathTest.h"
 
 #include <decaf/lang/Math.h>
+#include <decaf/lang/Double.h>
+#include <decaf/lang/Float.h>
 
 using namespace std;
 using namespace decaf;
@@ -25,8 +27,660 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 MathTest::MathTest() {
+    this->HYP = Math::sqrt( 2.0 );
+    this->OPP = 1.0;
+    this->ADJ = 1.0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MathTest::test() {
+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
+    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 23.1119931725587",
+//            23.1119931725587, Math::cbrt(12345.6));
+    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 -23.111993172558684",
+//            -23.111993172558684, Math::cbrt(-12345.6));
+    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));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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() {
+    // 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));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.7976931348623157E308",
+            1.7976931348623157E308, Math::hypot(Double::MAX_VALUE, 211370.35));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5413.7185", 5413.7185, Math::hypot(
+            -5413.7185, Double::MIN_VALUE));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_IEEEremainderDD() {
+    // 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);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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(3.7389561269540406, Math::log10(5482.2158));
+    CPPUNIT_ASSERT_EQUAL(14.661551142893833, Math::log10(458723662312872.125782332587));
+    CPPUNIT_ASSERT_EQUAL(-0.9083828622192334, Math::log10(0.12348583358871));
+    CPPUNIT_ASSERT_EQUAL(308.25471555991675, Math::log10(Double::MAX_VALUE));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_log1p_D() {
+    // 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));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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.0, Math::sqrt(Math::pow(Math::sqrt(2), 4)));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_rintD() {
+    // 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);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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.115386441963859", 5.115386441963859,
+            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() {
+    // 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));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MathTest::test_ulp_f() {
+
+    // 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) );
+}
+

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.h?view=diff&rev=563955&r1=563954&r2=563955
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/lang/MathTest.h Wed Aug  8 10:44:28
2007
@@ -27,15 +27,107 @@
     class MathTest : public CppUnit::TestFixture
     {
         CPPUNIT_TEST_SUITE( MathTest );
-        CPPUNIT_TEST( test );
+        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();
+        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();
 
     };
 



Mime
View raw message