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

Modified Files:
      Tag: thread_rewrite
        test_lock_concept.cpp 
Log Message:
Templated test_initially_locked, and applied to boost::try_mutex::scoped_lock 
too


Index: test_lock_concept.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/thread/test/Attic/test_lock_concept.cpp,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- test_lock_concept.cpp       8 Jun 2006 14:33:29 -0000       1.1.2.3
+++ test_lock_concept.cpp       8 Jun 2006 14:40:43 -0000       1.1.2.4
@@ -6,14 +6,18 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/thread/mutex.hpp>
 
-void test_mutex_scoped_lock_initially_locked()
+template<typename Mutex,typename Lock>
+struct test_initially_locked
 {
-    boost::mutex m;
-    boost::mutex::scoped_lock lock(m);
-    
-    BOOST_CHECK(lock);
-    BOOST_CHECK(lock.locked());
-}
+    void operator()() const
+    {
+        Mutex m;
+        Lock lock(m);
+        
+        BOOST_CHECK(lock);
+        BOOST_CHECK(lock.locked());
+    }
+};
 
 void test_mutex_scoped_lock_initially_locked_with_bool_parameter_true()
 {
@@ -73,7 +77,8 @@
     boost::unit_test_framework::test_suite* test =
         BOOST_TEST_SUITE("Boost.Threads: lock concept test suite");
 
-    test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_initially_locked));
+    
test->add(BOOST_TEST_CASE((test_initially_locked<boost::mutex,boost::mutex::scoped_lock>())));
+    
test->add(BOOST_TEST_CASE((test_initially_locked<boost::try_mutex,boost::try_mutex::scoped_lock>())));
     
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_initially_locked_with_bool_parameter_true));
     
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_initially_unlocked_with_bool_parameter_false));
     
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_unlocked_after_unlock_called));



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

Reply via email to