File tree Expand file tree Collapse file tree 4 files changed +84
-0
lines changed Expand file tree Collapse file tree 4 files changed +84
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ set(TEST_SRCS
4848 src/Ringbuffer/test_read_char.cpp
4949 src/Ringbuffer/test_store_char.cpp
5050 src/Stream/test_getTimeout.cpp
51+ src/Stream/test_setTimeout.cpp
5152 src/String /test_concat.cpp
5253 src/String /test_operators.cpp
5354 src/String /test_compareTo.cpp
@@ -80,6 +81,7 @@ set(TEST_DUT_SRCS
8081 ../api/Common.cpp
8182 ../api/IPAddress.cpp
8283 ../api/String .cpp
84+ ../api/Stream.cpp
8385 ../api/Print.cpp
8486)
8587
@@ -90,6 +92,7 @@ set(TEST_TARGET_SRCS
9092 src/dtostrf.cpp
9193 src/itoa.cpp
9294 src/PrintMock.cpp
95+ src/millis.cpp
9396 ${TEST_SRCS}
9497 ${TEST_DUT_SRCS}
9598)
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2020 Arduino. All rights reserved.
3+ */
4+
5+ #ifndef MILLIS_H_
6+ #define MILLIS_H_
7+
8+ /**************************************************************************************
9+ * INCLUDE
10+ **************************************************************************************/
11+
12+ #include <Common.h>
13+
14+ /**************************************************************************************
15+ * FUNCTION DECLARATION
16+ **************************************************************************************/
17+
18+ #ifdef __cplusplus
19+ extern "C" {
20+ #endif
21+
22+ void set_millis (unsigned long const val );
23+
24+ #ifdef __cplusplus
25+ }
26+ #endif
27+
28+ #endif /* MILLIS_H_ */
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2020 Arduino. All rights reserved.
3+ */
4+
5+ /* *************************************************************************************
6+ * INCLUDE
7+ **************************************************************************************/
8+
9+ #include < catch.hpp>
10+
11+ #include < StreamMock.h>
12+
13+ /* *************************************************************************************
14+ * TEST CODE
15+ **************************************************************************************/
16+
17+ TEST_CASE (" Verifying if calling 'setTimeout' is indeed modifying the timeout" , " [Stream-setTimeout-01]" )
18+ {
19+ StreamMock mock;
20+
21+ mock.setTimeout (100 );
22+
23+ REQUIRE (mock.getTimeout () == 100 );
24+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2020 Arduino. All rights reserved.
3+ */
4+
5+ /* *************************************************************************************
6+ * INCLUDE
7+ **************************************************************************************/
8+
9+ #include < millis.h>
10+
11+ /* *************************************************************************************
12+ * GLOBAL VARIABLES
13+ **************************************************************************************/
14+
15+ static unsigned long millis_val = 0 ;
16+
17+ /* *************************************************************************************
18+ * FUNCTION DEFINITION
19+ **************************************************************************************/
20+
21+ void set_millis (unsigned long const val)
22+ {
23+ millis_val = val;
24+ }
25+
26+ unsigned long millis ()
27+ {
28+ return millis_val;
29+ }
You can’t perform that action at this time.
0 commit comments