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() );
WFlag< bool > * flag
The flag to be tested.
void threadMain()
Thread function.
bool finished
True if the thread finishes.
Implements a WCondition, but can be fired only ONCE.
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 m_testTemporary
A temporary holder for some value.
void setTemporary()
Helper function which simply sets the value above to true.
void testInstantiation(void)
An instantiation should never throw an exception, as well as tear down.
void testChangeFlagAndReset()
Test whether change flag is set and reset.
void testWaitNotify()
Test whether notification is working.
void testCopyConstruction()
Test whether copy construction/cloning is working.
virtual void wait() const
Wait for the flag to change its value.
std::shared_ptr< WCondition > getCondition()
Returns the condition that is used by this flag.
virtual bool changed(bool reset=false)
True whenever the value inside this flag has changed since the last reset.
virtual const T & get(bool resetChangeState=false)
Operator returns value of the flag.
std::shared_ptr< WCondition > getValueChangeCondition()
Returns the condition denoting a value change.
virtual bool set(const T &value, bool suppressNotification=false)
Sets the new value for this flag.