summaryrefslogtreecommitdiff
path: root/libadhocutil/unittests/testLocks.cpp
blob: 4b0bad51be4fcc6a0816a3660e4ad0df304d9d22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#define BOOST_TEST_MODULE Locks
#include <boost/test/unit_test.hpp>

#include "lockHelpers.h"
#include <boost/thread/shared_mutex.hpp>

BOOST_AUTO_TEST_CASE ( lock )
{
	boost::shared_mutex _lock;
	Lock(_lock);
}

BOOST_AUTO_TEST_CASE ( sharedlock )
{
	boost::shared_mutex _lock;
	SharedLock(_lock);
}

BOOST_AUTO_TEST_CASE ( upgradelock )
{
	boost::upgrade_mutex _lock;
	UpgradableLock(_lock, ln);
	UpgradeScopeLock(ln) { }
	UpgradeLock(ln);
}

BOOST_AUTO_TEST_CASE ( scopelock )
{
	boost::shared_mutex _lock;
	ScopeLock(_lock) { }
}

BOOST_AUTO_TEST_CASE ( sharedscopelock )
{
	boost::shared_mutex _lock;
	SharedScopeLock(_lock) { }
}

BOOST_AUTO_TEST_CASE ( upgradescopelock )
{
	boost::upgrade_mutex _lock;
	UpgradableScopeLock(_lock, ln) {
		UpgradeScopeLock(ln) { }
		UpgradeLock(ln);
	}
}