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:
Ken Van Hoeylandt
2026-08-13 23:01:12 +02:00
committed by GitHub
parent d6b1d15e56
commit f943c4dd69
64 changed files with 137 additions and 1539 deletions
@@ -0,0 +1,39 @@
#include "doctest.h"
#include <Tactility/Semaphore.h>
#include <Tactility/Lock.h>
#include <Tactility/Mutex.h>
using namespace tt;
TEST_CASE("withLock() locks correctly on Semaphore") {
auto semaphore = std::make_shared<Semaphore>(2U);
semaphore->withLock([semaphore](){
CHECK_EQ(semaphore->getAvailable(), 1);
});
}
TEST_CASE("withLock() unlocks correctly on Semaphore") {
auto semaphore = std::make_shared<Semaphore>(2U);
semaphore->withLock([=](){
// NO-OP
});
CHECK_EQ(semaphore->getAvailable(), 2);
}
TEST_CASE("withLock() locks correctly on Mutex") {
auto mutex = std::make_shared<Mutex>();
mutex->withLock([mutex](){
CHECK_EQ(mutex->lock(1), false);
});
}
TEST_CASE("withLock() unlocks correctly on Mutex") {
auto mutex = std::make_shared<Mutex>();
mutex->withLock([=](){
// NO-OP
});
CHECK_EQ(mutex->lock(1), true);
mutex->unlock();
}