You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
478 B
33 lines
478 B
14 years ago
|
#include <cxxtest/TestSuite.h>
|
||
|
|
||
|
#define private public // need to reach private variables
|
||
|
|
||
|
#include "Common.hpp"
|
||
|
#include "Mutex.hpp"
|
||
|
|
||
|
class TestPThreadWrappers : public CxxTest::TestSuite
|
||
|
{
|
||
|
|
||
|
|
||
|
public:
|
||
|
|
||
|
void testMutexBasic( void )
|
||
|
{
|
||
|
Mutex m;
|
||
|
m.lock();
|
||
|
TS_ASSERT_EQUALS ( m.tryLock(0), 0 );
|
||
|
m.unlock();
|
||
|
}
|
||
|
|
||
|
void testMutexCreate( void )
|
||
|
{
|
||
|
Mutex m(PTHREAD_MUTEX_ERRORCHECK);
|
||
|
m.lock();
|
||
|
TS_ASSERT_EQUALS ( m.lock(), 1 );
|
||
|
|
||
|
m.unlock();
|
||
|
}
|
||
|
|
||
|
|
||
|
};
|