You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
441 B
32 lines
441 B
#include <cxxtest/TestSuite.h>
|
|
|
|
#include "ThreadPool.hpp"
|
|
#include "Task.hpp"
|
|
#include "Common.hpp"
|
|
|
|
|
|
class TestThreadPoolSuite : public CxxTest::TestSuite
|
|
{
|
|
|
|
public:
|
|
|
|
void testBasic()
|
|
{
|
|
TRACE("testBasic begin");
|
|
|
|
ThreadPool* tp = new ThreadPool(5);
|
|
tp->startWorkerThreads();
|
|
|
|
Task* t1 = new Task();
|
|
tp->pushTask(t1);
|
|
|
|
sleep(2);
|
|
|
|
tp->stop();
|
|
tp->join();
|
|
delete tp;
|
|
|
|
TRACE("testBasic end");
|
|
}
|
|
};
|