diff --git a/tests/test_stream.cpp b/tests/test_stream.cpp --- a/tests/test_stream.cpp +++ b/tests/test_stream.cpp @@ -179,7 +179,7 @@ TEST_CASE("adding data to a stream with } } -TEST_CASE("paused stream shoulnd't store data", "[memory, stream, pause]") +TEST_CASE("paused stream shouldn't store data", "[memory, stream, pause]") { Stream s(3, false, 10); @@ -211,3 +211,36 @@ TEST_CASE("paused stream shoulnd't store } } } + +TEST_CASE("clear stream data", "[memory, stream, pause]") +{ + Stream s(3, false, 10); + + // prepare data + SamplePack pack(5, 3, false); + for (unsigned ci = 0; ci < 3; ci++) + { + for (unsigned i = 0; i < 5; i++) + { + pack.data(ci)[i] = i; + } + } + + TestSource so(3, false); + so.connect(&s); + + // test + so._feed(pack); + s.clear(); + + for (unsigned ci = 0; ci < 3; ci++) + { + const StreamChannel* c = s.channel(ci); + const FrameBuffer* y = c->yData(); + + for (unsigned i = 0; i < 10; i++) + { + REQUIRE(y->sample(i) == 0); + } + } +}