diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-07-15 12:53:16 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-07-15 12:53:16 -0400 |
commit | 020ca43ed04c5effc00dea055d9c227627c6a8b7 (patch) | |
tree | 16102c6b1112477be9db35d1191101b10a3a6cbb /libs/pbd/test | |
parent | a8647faca7d60ba6404239f2ebcff1631028fbad (diff) |
add and Update mutex test that is no longer necessary now that glib has been fixed
Diffstat (limited to 'libs/pbd/test')
-rw-r--r-- | libs/pbd/test/mutex_test.cc | 24 | ||||
-rw-r--r-- | libs/pbd/test/mutex_test.h | 17 |
2 files changed, 41 insertions, 0 deletions
diff --git a/libs/pbd/test/mutex_test.cc b/libs/pbd/test/mutex_test.cc new file mode 100644 index 0000000000..52c36c4695 --- /dev/null +++ b/libs/pbd/test/mutex_test.cc @@ -0,0 +1,24 @@ +#include "mutex_test.h" + +CPPUNIT_TEST_SUITE_REGISTRATION (MutexTest); + +using namespace std; + +MutexTest::MutexTest () +{ +} + +void +MutexTest::testBasic () +{ + Glib::Threads::Mutex::Lock lm (m_mutex); + + CPPUNIT_ASSERT (lm.locked()); + + /* This will fail on POSIX systems but not on some older versions of glib + * on win32 as TryEnterCriticalSection is used and it will return true + * as CriticalSection is reentrant and fail the assertion. + */ + CPPUNIT_ASSERT (!m_mutex.trylock()); + +} diff --git a/libs/pbd/test/mutex_test.h b/libs/pbd/test/mutex_test.h new file mode 100644 index 0000000000..95b6ea3f65 --- /dev/null +++ b/libs/pbd/test/mutex_test.h @@ -0,0 +1,17 @@ +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include "glibmm/threads.h" + +class MutexTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE (MutexTest); + CPPUNIT_TEST (testBasic); + CPPUNIT_TEST_SUITE_END (); + +public: + MutexTest (); + void testBasic (); + +private: + Glib::Threads::Mutex m_mutex; +}; |