Move tests to relevant subprojects (#615)
- Moved test projects to the parent project they belong to - Improved test stability/corectness - Improved recursive directory deletion by safely ignoring current- and parent-directory entries. - Update docs
This commit is contained in:
committed by
GitHub
parent
d6b1d15e56
commit
f943c4dd69
@@ -0,0 +1,32 @@
|
||||
#include "doctest.h"
|
||||
#include <Tactility/DispatcherThread.h>
|
||||
#include <Tactility/Semaphore.h>
|
||||
|
||||
using namespace tt;
|
||||
|
||||
TEST_CASE("DispatcherThread state test") {
|
||||
DispatcherThread thread("test");
|
||||
CHECK_EQ(thread.isStarted(), false);
|
||||
|
||||
thread.start();
|
||||
CHECK_EQ(thread.isStarted(), true);
|
||||
|
||||
thread.stop();
|
||||
CHECK_EQ(thread.isStarted(), false);
|
||||
}
|
||||
|
||||
TEST_CASE("DispatcherThread should consume jobs") {
|
||||
DispatcherThread thread("test");
|
||||
thread.start();
|
||||
int counter = 0;
|
||||
Semaphore done(1, 0);
|
||||
|
||||
thread.dispatch([&counter, &done]() {
|
||||
counter++;
|
||||
done.release();
|
||||
});
|
||||
|
||||
CHECK(done.acquire(pdMS_TO_TICKS(2000)));
|
||||
CHECK_EQ(counter, 1);
|
||||
thread.stop();
|
||||
}
|
||||
Reference in New Issue
Block a user