diff options
author | Pixel <pixel@nobis-crew.org> | 2012-04-08 18:28:50 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-04-08 18:28:50 -0700 |
commit | dbf734fcf0ade3d92df31e4f0a7c0a5bd2b5605f (patch) | |
tree | a1e9703762212bf722ce109c41a7895baed47ab5 /tests | |
parent | d6f9bd366abf348fa562614c47050668139042f0 (diff) |
Slightly more tests for the stackless task unit test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-Tasks.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test-Tasks.cc b/tests/test-Tasks.cc index 9b2bda1..159b0f6 100644 --- a/tests/test-Tasks.cc +++ b/tests/test-Tasks.cc @@ -25,14 +25,18 @@ class TestOperation { public: TestOperation() : m_count(0), m_completed(false) { } void Do() { - if (m_count++ == 0) - Task::yield(NULL, true); + if (m_count++ == 0) { + m_timeout.set(0.2); + Task::yield(&m_timeout, true); + } + TAssert(m_timeout.gotSignal()); m_completed = true; } bool completed() { return m_completed; } private: int m_count; bool m_completed; + Events::Timeout m_timeout; }; class TestStackless : public StacklessTask { @@ -43,6 +47,7 @@ class TestStackless : public StacklessTask { StacklessBegin(); m_operation = new TestOperation(); StacklessOperation(m_operation->Do()); + TAssert(m_operation->completed()); delete m_operation; StacklessEnd(); } |