73 os <<
"COROUTINE_TEST_EVENT[ type: " << (int) aObj.
m_type <<
", value: " << aObj.
m_value
102 m_handler( { COROUTINE_TEST_EVENT::TYPE::START, 0 } );
104 for(
int i = 1; i <= n; i++ )
106 m_handler( { COROUTINE_TEST_EVENT::TYPE::YIELD, i } );
125 m_handler( { COROUTINE_TEST_EVENT::TYPE::RETURNED, ret_val } );
129 m_handler( { COROUTINE_TEST_EVENT::TYPE::END, ret_val } );
151 const std::vector<COROUTINE_TEST_EVENT> exp_events = {
152 { COROUTINE_TEST_EVENT::TYPE::CALL, count },
153 { COROUTINE_TEST_EVENT::TYPE::START, 0 },
154 { COROUTINE_TEST_EVENT::TYPE::YIELD, 1 },
155 { COROUTINE_TEST_EVENT::TYPE::RETURNED, 1 },
156 { COROUTINE_TEST_EVENT::TYPE::YIELD, 2 },
157 { COROUTINE_TEST_EVENT::TYPE::RETURNED, 2 },
158 { COROUTINE_TEST_EVENT::TYPE::END, 2 },
161 std::vector<COROUTINE_TEST_EVENT> received_events;
164 received_events.push_back( aEvent );
171 BOOST_CHECK_EQUAL_COLLECTIONS(
172 received_events.begin(), received_events.end(), exp_events.begin(), exp_events.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 & boost_test_print_type(std::ostream &os, const COROUTINE_TEST_EVENT &aObj)
Define a stream function for logging this type.
BOOST_AUTO_TEST_SUITE_END()