Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc4a6cc7

Browse files
committed
Adding test code for Print::print/println(unsigned char, int)
1 parentcbd8350 commitc4a6cc7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎test/src/Print/test_print.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,13 @@ TEST_CASE ("Print::print(Printable)", "[Print-print-11]")
160160

161161
REQUIRE(mock._str =="PrintableMock i = 1");
162162
}
163+
164+
TEST_CASE ("Print::print(unsigned char, int)","[Print-print-12]")
165+
{
166+
PrintMock mock;
167+
168+
WHEN("DEC") { mock.print('A', DEC);REQUIRE(mock._str =="65"); }
169+
WHEN("HEX") { mock.print('A', HEX);REQUIRE(mock._str =="41"); }
170+
WHEN("OCT") { mock.print('A', OCT);REQUIRE(mock._str =="101"); }
171+
WHEN("BIN") { mock.print('A', BIN);REQUIRE(mock._str =="1000001"); }
172+
}

‎test/src/Print/test_println.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,12 @@ TEST_CASE ("Print::println(Printable)", "[Print-println-11]")
126126

127127
REQUIRE(mock._str =="PrintableMock i = 1\r\n");
128128
}
129+
130+
TEST_CASE ("Print::println(unsigned char, int base = DEC (default))","[Print-println-12]")
131+
{
132+
PrintMock mock;
133+
134+
mock.println('A', DEC);
135+
136+
REQUIRE(mock._str =="65\r\n");
137+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp