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,37 @@
|
||||
#include "doctest.h"
|
||||
#include <Tactility/Dispatcher.h>
|
||||
|
||||
using namespace tt;
|
||||
|
||||
TEST_CASE("dispatcher should not call callback if consume isn't called") {
|
||||
int counter = 0;
|
||||
Dispatcher dispatcher;
|
||||
dispatcher.dispatch([&counter]() { counter++; });
|
||||
kernel::delayTicks(10);
|
||||
|
||||
CHECK_EQ(counter, 0);
|
||||
}
|
||||
|
||||
TEST_CASE("dispatcher should be able to dealloc when message is not consumed") {
|
||||
auto* dispatcher = new Dispatcher();
|
||||
auto context = std::make_shared<uint32_t>();
|
||||
dispatcher->dispatch([]() { /* NO-OP */ });
|
||||
delete dispatcher;
|
||||
}
|
||||
|
||||
TEST_CASE("dispatcher should call callback when consume is called") {
|
||||
int counter = 0;
|
||||
Dispatcher dispatcher;
|
||||
|
||||
CHECK_EQ(dispatcher.dispatch([&counter] { counter++; }), true);
|
||||
CHECK_EQ(dispatcher.consume(100), 1);
|
||||
|
||||
CHECK_EQ(counter, 1);
|
||||
}
|
||||
|
||||
TEST_CASE("message should be passed on correctly") {
|
||||
Dispatcher dispatcher;
|
||||
|
||||
dispatcher.dispatch([]() { /* NO-OP */ });
|
||||
dispatcher.consume(100);
|
||||
}
|
||||
Reference in New Issue
Block a user