Refactor how frames are sent from receiver

This commit is contained in:
2024-04-14 21:47:06 +02:00
parent 5a793a9260
commit 85a169ec19
85 changed files with 1385 additions and 3656 deletions

View File

@@ -3,6 +3,8 @@
#include <catch2/catch.hpp>
#include <../common/ThreadSafeFIFO.h>
using namespace std::chrono_literals;
TEST_CASE("ThreadSafeFIFO","[ThreadSafeFIFO]") {
ThreadSafeFIFO<uint32_t> fifo;
uint32_t tmp;
@@ -49,6 +51,27 @@ TEST_CASE("ThreadSafeFIFO_LimitedSize","[ThreadSafeFIFO]") {
fifo.GetBlocking();
}
TEST_CASE("ThreadSafeFIFO_GetTimeout","[ThreadSafeFIFO]") {
ThreadSafeFIFO<uint32_t> fifo;
uint32_t tmp;
fifo.Put(0);
fifo.Put(1);
REQUIRE(fifo.GetTimeout(tmp, 1ms) == 1);
CHECK (tmp == 0);
fifo.Put(0);
REQUIRE(fifo.GetTimeout(tmp, 1ms)== 1);
CHECK (tmp == 1);
REQUIRE(fifo.GetTimeout(tmp, 1ms) == 1);
CHECK (tmp == 0);
REQUIRE(fifo.GetTimeout(tmp, 1ms) == 0);
REQUIRE(fifo.GetTimeout(tmp, 1ms) == 0);
}
TEST_CASE("ThreadSafeSet","[ThreadSafeFIFO]") {
ThreadSafeSet<uint32_t> set;
uint32_t tmp;