Skip to content

Commit ff7e4a6

Browse files
committed
Adding test code for Stream::readString
1 parent 716c324 commit ff7e4a6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/src/Stream/test_readString.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2020 Arduino. All rights reserved.
3+
*/
4+
5+
/**************************************************************************************
6+
* INCLUDE
7+
**************************************************************************************/
8+
9+
#include <catch.hpp>
10+
11+
#include <MillisFake.h>
12+
#include <StreamMock.h>
13+
#include <iostream>
14+
/**************************************************************************************
15+
* TEST CODE
16+
**************************************************************************************/
17+
18+
TEST_CASE ("Testing 'readString' with data available within the stream", "[Stream-readString-01]")
19+
{
20+
StreamMock mock;
21+
mock.setTimeout(10);
22+
millis_autoOn();
23+
mock << "This is test stream content";
24+
25+
REQUIRE(mock.readString() == arduino::String("This is test stream content"));
26+
}

0 commit comments

Comments
 (0)