30 #include <boost/thread.hpp>
31 #include <cxxtest/TestSuite.h>
34 #include "../WConditionOneShot.h"
99 TS_ASSERT_THROWS_NOTHING(
delete flag );
110 TS_ASSERT( !( *t.
flag )() );
116 ( *t.
flag )(
false );
124 TS_ASSERT( ( *t.
flag )() );
142 flag->
set( !flag->
get(
true ) );
151 flag->
set( !flag->
get(
true ), true );
155 flag->
set( flag->
get(
true ) );
171 bool v = flag->
get();
176 v = flag->
get(
true );
194 TS_ASSERT( flag->
get() == flagClone->
get() );
200 flagClone->
set( !flagClone->
get(
true ) );
201 TS_ASSERT( flag->
get() != flagClone->
get() );
210 #endif // WFLAG_TEST_H
boost::signals2::connection subscribeSignal(t_ConditionNotifierType notifier) const
Subscribes a specified function to be notified on condition change.
void testChangeCondition()
Test whether change condition is fired.
bool flag
Flag set to true when thread starts.
boost::shared_ptr< WCondition > getCondition()
Returns the condition that is used by this flag.
void setTemporary()
Helper function which simply sets the value above to true.
Implements a WCondition, but can be fired only ONCE.
void threadMain()
Thread function.
bool m_testTemporary
A temporary holder for some value.
bool finished
True if the thread finishes.
void testChangeFlagAndReset()
Test whether change flag is set and reset.
WFlag< bool > * flag
The flag to be tested.
void testInstantiation(void)
An instantiation should never throw an exception, as well as tear down.
virtual bool changed(bool reset=false)
True whenever the value inside this flag has changed since the last reset.
void testWaitNotify()
Test whether notification is working.
void testCopyConstruction()
Test whether copy construction/cloning is working.
virtual bool set(const T &value, bool suppressNotification=false)
Sets the new value for this flag.
virtual const T & get(bool resetChangeState=false)
Operator returns value of the flag.
boost::shared_ptr< WCondition > getValueChangeCondition()
Returns the condition denoting a value change.