75 os <<
"COROUTINE_TEST_EVENT[ type: " << (int) aObj.
m_type <<
", value: " << aObj.
m_value
104 m_handler( { COROUTINE_TEST_EVENT::TYPE::START, 0 } );
106 for(
int i = 1; i <= n; i++ )
108 m_handler( { COROUTINE_TEST_EVENT::TYPE::YIELD, i } );
127 m_handler( { COROUTINE_TEST_EVENT::TYPE::RETURNED, ret_val } );
131 m_handler( { COROUTINE_TEST_EVENT::TYPE::END, ret_val } );
153 const std::vector<COROUTINE_TEST_EVENT> exp_events = {
154 { COROUTINE_TEST_EVENT::TYPE::CALL, count },
155 { COROUTINE_TEST_EVENT::TYPE::START, 0 },
156 { COROUTINE_TEST_EVENT::TYPE::YIELD, 1 },
157 { COROUTINE_TEST_EVENT::TYPE::RETURNED, 1 },
158 { COROUTINE_TEST_EVENT::TYPE::YIELD, 2 },
159 { COROUTINE_TEST_EVENT::TYPE::RETURNED, 2 },
160 { COROUTINE_TEST_EVENT::TYPE::END, 2 },
163 std::vector<COROUTINE_TEST_EVENT> received_events;
166 received_events.push_back( aEvent );
173 BOOST_CHECK_EQUAL_COLLECTIONS(
174 received_events.begin(), received_events.end(), exp_events.begin(), exp_events.end() );
177BOOST_AUTO_TEST_SUITE_END()
Simple coroutine harness that runs a coroutine that increments a number up to a pre-set limit,...
std::unique_ptr< TEST_COROUTINE > m_cofunc
std::function< void(const COROUTINE_TEST_EVENT &)> EVT_HANDLER
COROUTINE_INCREMENTING_HARNESS(EVT_HANDLER aHandler, int aCount)
An event in a simple coroutine harness.
bool operator!=(const COROUTINE_TEST_EVENT &aOther) const
bool operator==(const COROUTINE_TEST_EVENT &aOther) const
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(Increment)
Declare the test suite.
std::ostream & operator<<(std::ostream &os, const COROUTINE_TEST_EVENT &aObj)
Define a stream function for logging this type.