[Orxonox-commit 4685] r9356 - in code/branches/testing: src/libraries/util test/util

landauf at orxonox.net landauf at orxonox.net
Sat Sep 1 11:32:21 CEST 2012


Author: landauf
Date: 2012-09-01 11:32:20 +0200 (Sat, 01 Sep 2012)
New Revision: 9356

Modified:
   code/branches/testing/src/libraries/util/MultiType.h
   code/branches/testing/test/util/ConvertTest.cc
Log:
details

Modified: code/branches/testing/src/libraries/util/MultiType.h
===================================================================
--- code/branches/testing/src/libraries/util/MultiType.h	2012-09-01 08:38:27 UTC (rev 9355)
+++ code/branches/testing/src/libraries/util/MultiType.h	2012-09-01 09:32:20 UTC (rev 9356)
@@ -329,7 +329,6 @@
 
             /// Converts the current value to type T.
             template <typename T> inline bool convert() { return this->force<T>(MultiType(*this)); }
-//            template <typename T> inline bool convert() { return this->force<T>(this->get<typename Loki::TypeTraits<T>::UnqualifiedReferredType>()); }
 
             /// Resets value and type. Type will be void afterwards and null() returns true.
             inline void reset() { if (this->value_) delete this->value_; this->value_ = 0; }

Modified: code/branches/testing/test/util/ConvertTest.cc
===================================================================
--- code/branches/testing/test/util/ConvertTest.cc	2012-09-01 08:38:27 UTC (rev 9355)
+++ code/branches/testing/test/util/ConvertTest.cc	2012-09-01 09:32:20 UTC (rev 9356)
@@ -90,10 +90,15 @@
         EXPECT_EQ('a', multi_cast<char>(std::string("a")));
         EXPECT_EQ('\n', multi_cast<char>(std::string("\n")));
         EXPECT_EQ('\0', multi_cast<char>(std::string("")));
+        EXPECT_EQ('1', multi_cast<char>(std::string("123")));
 
         // bool
         EXPECT_TRUE(multi_cast<bool>(std::string("true")));
         EXPECT_FALSE(multi_cast<bool>(std::string("false")));
+        EXPECT_FALSE(multi_cast<bool>(std::string("0")));
+        EXPECT_FALSE(multi_cast<bool>(std::string("0.123")));
+        EXPECT_TRUE(multi_cast<bool>(std::string("1")));
+        EXPECT_TRUE(multi_cast<bool>(std::string("123.456")));
 
         // TODO: Check consistency of conversion depending on MathConvert.h and reversibility
 /*




More information about the Orxonox-commit mailing list