13
0

add and Update mutex test that is no longer necessary now that glib has been fixed

This commit is contained in:
Paul Davis 2013-07-15 12:53:16 -04:00
parent a8647faca7
commit 020ca43ed0
2 changed files with 41 additions and 0 deletions

View File

@ -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());
}

View File

@ -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;
};