Update of /cvsroot/boost/boost/libs/thread/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18192

Modified Files:
      Tag: thread_rewrite
        test_lock_concept.cpp 
Log Message:
templated test_throws_if_lock_called_when_already_locked


Index: test_lock_concept.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/thread/test/Attic/test_lock_concept.cpp,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- test_lock_concept.cpp       8 Jun 2006 14:53:02 -0000       1.1.2.7
+++ test_lock_concept.cpp       8 Jun 2006 16:22:33 -0000       1.1.2.8
@@ -73,13 +73,17 @@
     }
 };
 
-void test_mutex_scoped_lock_throws_if_lock_called_when_already_locked()
+template<typename Mutex,typename Lock>
+struct test_throws_if_lock_called_when_already_locked
 {
-    boost::mutex m;
-    boost::mutex::scoped_lock lock(m,true);
-    
-    BOOST_CHECK_THROW( lock.lock(), boost::lock_error );
-}
+    void operator()() const
+    {
+        Mutex m;
+        Lock lock(m,true);
+        
+        BOOST_CHECK_THROW( lock.lock(), boost::lock_error );
+    }
+};
 
 void test_mutex_scoped_lock_throws_if_unlock_called_when_already_unlocked()
 {
@@ -100,7 +104,7 @@
     
test->add(BOOST_TEST_CASE((test_initially_unlocked_with_bool_parameter_false<boost::mutex,boost::mutex::scoped_lock>())));
     
test->add(BOOST_TEST_CASE((test_unlocked_after_unlock_called<boost::mutex,boost::mutex::scoped_lock>())));
     
test->add(BOOST_TEST_CASE((test_locked_after_lock_called<boost::mutex,boost::mutex::scoped_lock>())));
-    
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_throws_if_lock_called_when_already_locked));
+    
test->add(BOOST_TEST_CASE((test_throws_if_lock_called_when_already_locked<boost::mutex,boost::mutex::scoped_lock>())));
     
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_throws_if_unlock_called_when_already_unlocked));
 
     
test->add(BOOST_TEST_CASE((test_initially_locked<boost::try_mutex,boost::try_mutex::scoped_lock>())));



_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to