Update of /cvsroot/boost/boost/libs/thread/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1627
Modified Files:
Tag: thread_rewrite
test_lock_concept.cpp
Log Message:
Added more checks round scoped_lock concept
Index: test_lock_concept.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/thread/test/Attic/test_lock_concept.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- test_lock_concept.cpp 8 Jun 2006 14:24:15 -0000 1.1.2.2
+++ test_lock_concept.cpp 8 Jun 2006 14:33:29 -0000 1.1.2.3
@@ -15,19 +15,46 @@
BOOST_CHECK(lock.locked());
}
+void test_mutex_scoped_lock_initially_locked_with_bool_parameter_true()
+{
+ boost::mutex m;
+ boost::mutex::scoped_lock lock(m,true);
+
+ BOOST_CHECK(lock);
+ BOOST_CHECK(lock.locked());
+}
+
+void test_mutex_scoped_lock_initially_unlocked_with_bool_parameter_false()
+{
+ boost::mutex m;
+ boost::mutex::scoped_lock lock(m,false);
+
+ BOOST_CHECK(!lock);
+ BOOST_CHECK(!lock.locked());
+}
+
void test_mutex_scoped_lock_unlocked_after_unlock_called()
{
boost::mutex m;
- boost::mutex::scoped_lock lock(m);
+ boost::mutex::scoped_lock lock(m,true);
lock.unlock();
BOOST_CHECK(!lock);
BOOST_CHECK(!lock.locked());
}
+void test_mutex_scoped_lock_locked_after_lock_called()
+{
+ boost::mutex m;
+ boost::mutex::scoped_lock lock(m,false);
+ lock.lock();
+ BOOST_CHECK(lock);
+ BOOST_CHECK(lock.locked());
+}
+
void test_mutex_scoped_lock_throws_if_lock_called_when_already_locked()
{
boost::mutex m;
- boost::mutex::scoped_lock lock(m);
+ boost::mutex::scoped_lock lock(m,true);
BOOST_CHECK_THROW( lock.lock(), boost::lock_error );
}
@@ -35,7 +62,7 @@
void test_mutex_scoped_lock_throws_if_unlock_called_when_already_unlocked()
{
boost::mutex m;
- boost::mutex::scoped_lock lock(m);
+ boost::mutex::scoped_lock lock(m,true);
lock.unlock();
BOOST_CHECK_THROW( lock.unlock(), boost::lock_error );
@@ -47,7 +74,10 @@
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_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));
+
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_locked_after_lock_called));
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_throws_if_lock_called_when_already_locked));
test->add(BOOST_TEST_CASE(&test_mutex_scoped_lock_throws_if_unlock_called_when_already_unlocked));
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs