Skip to content

Commit d1dda97

Browse files
committed
Adding basic tests for 'Print::clearWriteError'
1 parent 369aad4 commit d1dda97

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ set(TEST_SRCS
2828
src/Common/test_makeWord.cpp
2929
src/Common/test_max.cpp
3030
src/Common/test_min.cpp
31+
src/Print/test_clearWriteError.cpp
3132
src/Print/test_getWriteError.cpp
3233
src/Print/test_print.cpp
3334
src/Ringbuffer/test_available.cpp
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2020 Arduino. All rights reserved.
3+
*/
4+
5+
/**************************************************************************************
6+
* INCLUDE
7+
**************************************************************************************/
8+
9+
#include <catch.hpp>
10+
11+
#include <Print.h>
12+
13+
#include <PrintMock.h>
14+
15+
/**************************************************************************************
16+
* TEST CODE
17+
**************************************************************************************/
18+
19+
TEST_CASE ("Clear write error should set the error code back to 0", "[Print-clearWriteError-01]")
20+
{
21+
PrintMock mock;
22+
mock.mock_setWriteError(5);
23+
mock.clearWriteError();
24+
REQUIRE(mock.getWriteError() == 0);
25+
}

0 commit comments

Comments
 (0)