[hal, wpilib] Add RobotController.getComments() (#4463)

This commit is contained in:
Ryan Blue
2022-12-26 14:39:51 -05:00
committed by GitHub
parent 26bdbf3d41
commit 2ac41f3edc
19 changed files with 310 additions and 1 deletions

View File

@@ -224,4 +224,24 @@ TEST(RoboRioSimTest, SetSerialNumber) {
EXPECT_EQ(kSerialNumberTruncated, RobotController::GetSerialNumber());
}
TEST(RoboRioSimTest, SetComments) {
const std::string kComments =
"Hello! These are comments in the roboRIO web interface!";
RoboRioSim::ResetData();
RoboRioSim::SetComments(kComments);
EXPECT_EQ(kComments, RoboRioSim::GetComments());
EXPECT_EQ(kComments, RobotController::GetComments());
const std::string kCommentsOverflow =
"Hello! These are comments in the roboRIO web interface! This comment "
"exceeds 64 characters!";
const std::string kCommentsTruncated = kCommentsOverflow.substr(0, 64);
RoboRioSim::SetComments(kCommentsOverflow);
EXPECT_EQ(kCommentsTruncated, RoboRioSim::GetComments());
EXPECT_EQ(kCommentsTruncated, RobotController::GetComments());
}
} // namespace frc::sim