mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
31 lines
630 B
C++
31 lines
630 B
C++
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
|
|
// Copyright Benoit Blanchon 2019-2021
|
|
// MIT License
|
|
|
|
#include "SpyingAllocator.hpp"
|
|
|
|
#include "StreamUtils/Streams/HammingEncodingStream.hpp"
|
|
#include "StreamUtils/Streams/MemoryStream.hpp"
|
|
|
|
#include "doctest.h"
|
|
|
|
using namespace StreamUtils;
|
|
|
|
TEST_CASE("HammingEncodingStream") {
|
|
MemoryStream upstream(64);
|
|
|
|
HammingEncodingStream<7, 4> stream{upstream};
|
|
|
|
SUBCASE("read() forwards upstream data") {
|
|
upstream.print("A");
|
|
|
|
CHECK(stream.read() == 'A');
|
|
}
|
|
|
|
SUBCASE("write() encodes") {
|
|
stream.write('A');
|
|
|
|
CHECK(upstream.readString() == "Tq");
|
|
}
|
|
}
|