[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/eigen2/test
From:       Gael Guennebaud <g.gael () free ! fr>
Date:       2008-06-02 14:54:53
Message-ID: 1212418493.337503.21043.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 815749 by ggael:

added unit tests for sizeof and dynamic memory allocation


 M  +2 -0      CMakeLists.txt  
 M  +9 -8      main.h  
 A             nomalloc.cpp   [License: GPL (v3+) LGPL (v3+)]
 A             sizeof.cpp   [License: GPL (v3+) LGPL (v3+)]


--- branches/work/eigen2/test/CMakeLists.txt #815748:815749
@@ -68,6 +68,8 @@
 
 ADD_DEFINITIONS("-DEIGEN_EXTERN_INSTANCIATION=1")
 
+EI_ADD_TEST(sizeof)
+EI_ADD_TEST(nomalloc)
 EI_ADD_TEST(basicstuff)
 EI_ADD_TEST(linearstructure)
 EI_ADD_TEST(cwiseop)
--- branches/work/eigen2/test/main.h #815748:815749
@@ -53,7 +53,7 @@
   {
     static const bool should_raise_an_assert = false;
 
-    // Used to avoid to raise two exceptions at the time in which
+    // Used to avoid to raise two exceptions at a time in which
     // case the exception is not properly catched.
     // This may happen when a second exceptions is raise in a destructor.
     static bool no_more_assert = false;
@@ -93,6 +93,7 @@
 
     #define VERIFY_RAISES_ASSERT(a)                                               \
       {                                                                           \
+        Eigen::no_more_assert = false;                                            \
         try {                                                                     \
           Eigen::ei_assert_list.clear();                                          \
           Eigen::ei_push_assert = true;                                           \
@@ -101,25 +102,25 @@
           std::cerr << "One of the following asserts should have been raised:\n"; \
           for (uint ai=0 ; ai<ei_assert_list.size() ; ++ai)                       \
             std::cerr << "  " << ei_assert_list[ai] << "\n";                      \
-          VERIFY(Eigen::should_raise_an_assert && # a);                          \
+          VERIFY(Eigen::should_raise_an_assert && # a);                           \
         } catch (Eigen::ei_assert_exception e) {                                  \
-          Eigen::ei_push_assert = false; VERIFY(true);                           \
+          Eigen::ei_push_assert = false; VERIFY(true);                            \
         }                                                                         \
       }
 
   #else // EIGEN_DEBUG_ASSERTS
 
-    #define ei_assert(a)                       \
+    #define ei_assert(a) \
       if( (!(a)) && (!no_more_assert) )     \
       {                                     \
         Eigen::no_more_assert = true;       \
         throw Eigen::ei_assert_exception(); \
       }
 
-    #define VERIFY_RAISES_ASSERT(a)                                 \
-      {                                                             \
-        try { a; VERIFY(Eigen::should_raise_an_assert && # a); }   \
-        catch (Eigen::ei_assert_exception e) { VERIFY(true); }     \
+    #define VERIFY_RAISES_ASSERT(a) {                             \
+        Eigen::no_more_assert = false;                            \
+        try { a; VERIFY(Eigen::should_raise_an_assert && # a); }  \
+        catch (Eigen::ei_assert_exception e) { VERIFY(true); }    \
       }
 
   #endif // EIGEN_DEBUG_ASSERTS
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic