[Orxonox-commit 4355] r9026 - in code/branches/testing: src/libraries/util test/util

landauf at orxonox.net landauf at orxonox.net
Sun Mar 11 21:19:47 CET 2012


Author: landauf
Date: 2012-03-11 21:19:47 +0100 (Sun, 11 Mar 2012)
New Revision: 9026

Modified:
   code/branches/testing/src/libraries/util/Math.h
   code/branches/testing/test/util/MathTest.cc
Log:
removed obsolete (and wrong for negative values) round() function (exists also in cmath)

Modified: code/branches/testing/src/libraries/util/Math.h
===================================================================
--- code/branches/testing/src/libraries/util/Math.h	2012-03-11 19:26:30 UTC (rev 9025)
+++ code/branches/testing/src/libraries/util/Math.h	2012-03-11 20:19:47 UTC (rev 9026)
@@ -141,15 +141,6 @@
     }
 
     /**
-        @brief Rounds the value to the nearest integer.
-    */
-    template <typename T>
-    inline int round(T x)
-    {
-        return static_cast<int>(x + 0.5);
-    }
-
-    /**
         @brief The modulo operation, enhanced to work properly with negative values.
         @param x The value
         @param max The operand

Modified: code/branches/testing/test/util/MathTest.cc
===================================================================
--- code/branches/testing/test/util/MathTest.cc	2012-03-11 19:26:30 UTC (rev 9025)
+++ code/branches/testing/test/util/MathTest.cc	2012-03-11 20:19:47 UTC (rev 9026)
@@ -149,44 +149,6 @@
         EXPECT_DOUBLE_EQ( -8.000, cube(-2.0));
     }
 
-    /////////////
-    // round() //
-    /////////////
-    TEST(round, Positive)
-    {
-        // int
-        EXPECT_EQ( 5, round(5));
-        EXPECT_EQ(10, round(10));
-
-        // double
-        EXPECT_EQ(4, round(4.499));
-        EXPECT_EQ(5, round(4.500));
-        EXPECT_EQ(5, round(4.999));
-        EXPECT_EQ(5, round(5.000));
-        EXPECT_EQ(5, round(5.001));
-        EXPECT_EQ(5, round(5.499));
-        EXPECT_EQ(6, round(5.500));
-    }
-
-    /////////////
-    // round() //
-    /////////////
-    TEST(round, Negative)
-    {
-        // int
-        EXPECT_EQ( -5, round(-5));
-        EXPECT_EQ(-10, round(-10));
-
-        // double
-        EXPECT_EQ(-4, round(-4.499));
-        EXPECT_EQ(-5, round(-4.500));
-        EXPECT_EQ(-5, round(-4.999));
-        EXPECT_EQ(-5, round(-5.000));
-        EXPECT_EQ(-5, round(-5.001));
-        EXPECT_EQ(-5, round(-5.499));
-        EXPECT_EQ(-6, round(-5.500));
-    }
-
     ///////////
     // mod() //
     ///////////
@@ -239,7 +201,7 @@
         EXPECT_EQ((unsigned int)0, zeroise<unsigned int>());
         EXPECT_DOUBLE_EQ(0.0, zeroise<double>());
         EXPECT_EQ("", zeroise<std::string>());
-//        EXPECT_EQ(Vector3::ZERO, zeroise<Vector3>());
+        EXPECT_EQ(Vector3::ZERO, zeroise<Vector3>());
     }
 
     ///////////////////




More information about the Orxonox-commit mailing list