25 #ifndef WCONDITIONSET_TEST_H
26 #define WCONDITIONSET_TEST_H
30 #include <boost/thread.hpp>
31 #include <cxxtest/TestSuite.h>
33 #include "../WConditionSet.h"
34 #include "../WCondition.h"
60 boost::this_thread::sleep( boost::posix_time::seconds( 1 ) );
79 TS_ASSERT_THROWS_NOTHING(
delete c );
90 boost::shared_ptr< WCondition > c1(
new WCondition() );
91 boost::shared_ptr< WCondition > c2(
new WCondition() );
92 boost::shared_ptr< WCondition > c3(
new WCondition() );
95 TS_ASSERT_THROWS_NOTHING( cs->
add( c1 ) );
97 TS_ASSERT_THROWS_NOTHING( cs->
add( c1 ) );
98 TS_ASSERT_THROWS_NOTHING( cs->
add( c2 ) );
104 TS_ASSERT_THROWS_NOTHING( cs->
remove( c3 ) );
108 TS_ASSERT_THROWS_NOTHING( cs->
remove( c1 ) );
112 TS_ASSERT_THROWS_NOTHING( cs->
remove( c2 ) );
126 boost::shared_ptr< WCondition > c1(
new WCondition() );
127 boost::shared_ptr< WCondition > c2(
new WCondition() );
172 boost::shared_ptr< WCondition > c1(
new WCondition() );
173 boost::shared_ptr< WCondition > c2(
new WCondition() );
220 TS_ASSERT_THROWS_NOTHING( cs->
reset() );
226 #endif // WCONDITIONSET_TEST_H
virtual void remove(boost::shared_ptr< WCondition > condition)
Removes the specified condition.
virtual void wait() const
Wait for the condition.
bool flag
Flag set to true when thread starts.
virtual void add(boost::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
void threadMain()
Thread main method.
void testWaitResetable(void)
Tests the resetable feature.
void testWait(void)
Tests whether the condition set really reacts on fired conditions.
virtual void reset() const
Resets the internal fire state.
Class allowing multiple conditions to be used for one waiting cycle.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
bool m_fired
Flag denoting whether one condition fired in the past.
ConditionConnectionMap m_conditionSet
Set of conditions to be waited for.
Class to encapsulate boost::condition_variable_any.
WCondition * c
The condition to be used for signalling.
void testResetOnNotResetable(void)
Ensures reset() never throws something.
virtual void notify()
Notifies all waiting threads.
void testInstantiation(void)
An instantiation should never throw an exception, as well as tear down.
void testAddRemove(void)
Tests add and remove methods.