Skip to content

Commit f2dcfc4

Browse files
committed
Adding test code for Print::print/println(const __FlashStringHelper *)
1 parent 4bdadc9 commit f2dcfc4

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/src/Print/test_print.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,14 @@ TEST_CASE ("Print::print(unsigned char, int)", "[Print-print-12]")
170170
WHEN("OCT") { mock.print('A', OCT); REQUIRE(mock._str == "101"); }
171171
WHEN("BIN") { mock.print('A', BIN); REQUIRE(mock._str == "1000001"); }
172172
}
173+
174+
TEST_CASE ("Testing Print::print(const __FlashStringHelper *)", "[Print-print-13]")
175+
{
176+
#undef F
177+
#define F(string_literal) (reinterpret_cast<const arduino::__FlashStringHelper *>(PSTR(string_literal)))
178+
PrintMock mock;
179+
180+
mock.print(F("Hello flash string"));
181+
182+
REQUIRE(mock._str == "Hello flash string");
183+
}

test/src/Print/test_println.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,14 @@ TEST_CASE ("Print::println(unsigned char, int base = DEC (default))", "[Print-pr
135135

136136
REQUIRE(mock._str == "65\r\n");
137137
}
138+
139+
TEST_CASE ("Testing Print::println(const __FlashStringHelper *)", "[Print-println-13]")
140+
{
141+
#undef F
142+
#define F(string_literal) (reinterpret_cast<const arduino::__FlashStringHelper *>(PSTR(string_literal)))
143+
PrintMock mock;
144+
145+
mock.println(F("Hello flash string"));
146+
147+
REQUIRE(mock._str == "Hello flash string\r\n");
148+
}

0 commit comments

Comments
 (0)