Skip to content

Commit 05be8b0

Browse files
committed
Support 3-character inputs in EDU commands test
1 parent 2cdb305 commit 05be8b0

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

Tests/ManualTests/EduCommands.test.cpp

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <array>
1616
#include <charconv>
17-
#include <cinttypes>
1817
#include <cstddef>
1918
#include <cstdint>
2019
#include <span>
@@ -77,8 +76,8 @@ class EduCommandsTest : public RODOS::StaticThread<stackSize>
7776
case 'u':
7877
{
7978
auto currentTime = CurrentRealTime();
80-
PRINTF("Sending UpdateTime(currentTime = %d)\n",
81-
static_cast<int>(value_of(currentTime)));
79+
PRINTF("Sending UpdateTime(currentTime = %u)\n",
80+
static_cast<unsigned>(value_of(currentTime)));
8281
auto updateTimeResult = edu::UpdateTime({.currentTime = currentTime});
8382
if(updateTimeResult.has_error())
8483
{
@@ -92,26 +91,25 @@ class EduCommandsTest : public RODOS::StaticThread<stackSize>
9291
}
9392
case 'e':
9493
{
95-
PRINTF("Please enter a program ID (1 character)\n");
96-
auto userInput = ReadCharacters<1>();
94+
PRINTF("Please enter a program ID (3 character)\n");
95+
auto userInput = ReadCharacters<3>();
9796
auto programId = ProgramId(0);
9897
std::from_chars(userInput.begin(), userInput.end(), value_of(programId));
9998

100-
PRINTF("Please enter a start time (1 character)\n");
101-
userInput = ReadCharacters<1>();
99+
PRINTF("Please enter a start time (3 character)\n");
100+
userInput = ReadCharacters<3>();
102101
auto startTime = RealTime(0);
103102
std::from_chars(userInput.begin(), userInput.end(), value_of(startTime));
104103

105-
PRINTF("Please enter a timeout (1 character)\n");
106-
userInput = ReadCharacters<1>();
104+
PRINTF("Please enter a timeout (3 character)\n");
105+
userInput = ReadCharacters<3>();
107106
std::int16_t timeout = 0;
108107
std::from_chars(userInput.begin(), userInput.end(), timeout);
109108

110109
PRINTF("\n");
111-
PRINTF("Sending ExecuteProgram(programId = %" PRIu16 ", startTime = %" PRIi32
112-
", timeout = %" PRIi16 ")\n",
110+
PRINTF("Sending ExecuteProgram(programId = %u, startTime = %u, timeout = %d)\n",
113111
value_of(programId),
114-
value_of(startTime),
112+
static_cast<unsigned>(value_of(startTime)),
115113
timeout);
116114
auto executeProgramResult = edu::ExecuteProgram(
117115
{.programId = programId, .startTime = startTime, .timeout = timeout});
@@ -137,31 +135,29 @@ class EduCommandsTest : public RODOS::StaticThread<stackSize>
137135
{
138136
auto status = getStatusResult.value();
139137
PRINTF(" Status type = %d\n", static_cast<int>(status.statusType));
140-
PRINTF(" Program ID = %d\n",
141-
static_cast<int>(value_of(status.programId)));
142-
PRINTF(" Start time = %d\n",
143-
static_cast<int>(value_of(status.startTime)));
144-
PRINTF(" Exit code = %d\n", static_cast<int>(status.exitCode));
138+
PRINTF(" Program ID = %d\n", value_of(status.programId));
139+
PRINTF(" Start time = %u\n",
140+
static_cast<unsigned>(value_of(status.startTime)));
141+
PRINTF(" Exit code = %d\n", status.exitCode);
145142
}
146143
break;
147144
}
148145
case 'r':
149146
{
150-
PRINTF("Please enter a program ID (1 character)\n");
151-
auto userInput = ReadCharacters<1>();
147+
PRINTF("Please enter a program ID (3 character)\n");
148+
auto userInput = ReadCharacters<3>();
152149
auto programId = ProgramId(0);
153150
std::from_chars(userInput.begin(), userInput.end(), value_of(programId));
154151

155-
PRINTF("Please enter a start time (1 character)\n");
156-
userInput = ReadCharacters<1>();
152+
PRINTF("Please enter a start time (3 character)\n");
153+
userInput = ReadCharacters<3>();
157154
auto startTime = RealTime(0);
158155
std::from_chars(userInput.begin(), userInput.end(), value_of(startTime));
159156

160157
PRINTF("\n");
161-
PRINTF("Sending ReturnResult(programId = %" PRIu16 ", startTime = %" PRIi32
162-
")\n",
158+
PRINTF("Sending ReturnResult(programId = %u, startTime = %u)\n",
163159
value_of(programId),
164-
value_of(startTime));
160+
static_cast<unsigned>(value_of(startTime)));
165161
auto returnResultResult = edu::ReturnResult(
166162
edu::ReturnResultData{.programId = programId, .startTime = startTime});
167163
if(returnResultResult.has_error())

0 commit comments

Comments
 (0)