Create TactilityFreertos subproject (#440)

This commit is contained in:
Ken Van Hoeylandt
2026-01-03 00:19:40 +01:00
committed by GitHub
parent a4dc633063
commit 7283920def
154 changed files with 1926 additions and 2676 deletions
+36
View File
@@ -0,0 +1,36 @@
#include "doctest.h"
#include <Tactility/PubSub.h>
using namespace tt;
TEST_CASE("PubSub publishing with no subscriptions should not crash") {
PubSub<int> pubsub;
pubsub.publish(1);
}
TEST_CASE("PubSub subscription receives published data") {
PubSub<int> pubsub;
int value = 0;
auto subscription = pubsub.subscribe([&value](auto newValue) {
value = newValue;
});
pubsub.publish(1);
pubsub.unsubscribe(subscription);
CHECK_EQ(value, 1);
}
TEST_CASE("PubSub unsubscribed subscription does not receive published data") {
PubSub<int> pubsub;
int value = 0;
auto subscription = pubsub.subscribe([&value](auto newValue) {
value = newValue;
});
pubsub.unsubscribe(subscription);
pubsub.publish(1);
CHECK_EQ(value, 0);
}