mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[hal,wpilib] Switch to new game data (#8584)
Game data is now limited to 8 bytes, and comes through the UDP packets.
This commit is contained in:
@@ -18,7 +18,7 @@ class MatchInfoDataTest {
|
||||
@Test
|
||||
void testSetMatchInfo() {
|
||||
MatchType matchType = MatchType.Qualification;
|
||||
DriverStationDataJNI.setMatchInfo("Event Name", "Game Message", 174, 191, matchType.ordinal());
|
||||
DriverStationDataJNI.setMatchInfo("Event Name", 174, 191, matchType.ordinal());
|
||||
|
||||
DriverStationSim.notifyNewData();
|
||||
|
||||
@@ -29,7 +29,6 @@ class MatchInfoDataTest {
|
||||
() -> assertEquals("Event Name", outMatchInfo.eventName),
|
||||
() -> assertEquals(matchType.ordinal(), outMatchInfo.matchType),
|
||||
() -> assertEquals(174, outMatchInfo.matchNumber),
|
||||
() -> assertEquals(191, outMatchInfo.replayNumber),
|
||||
() -> assertEquals("Game Message", outMatchInfo.gameSpecificMessage));
|
||||
() -> assertEquals(191, outMatchInfo.replayNumber));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,14 +262,36 @@ class DriverStationSimTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSetGameSpecificMessage() {
|
||||
void testSetGameData() {
|
||||
HAL.initialize(500, 0);
|
||||
DriverStationSim.resetData();
|
||||
|
||||
final String message = "Hello World!";
|
||||
DriverStationSim.setGameSpecificMessage(message);
|
||||
final String message = "Hello";
|
||||
DriverStationSim.setGameData(message);
|
||||
DriverStationSim.notifyNewData();
|
||||
assertEquals(message, DriverStation.getGameSpecificMessage());
|
||||
var gameData = DriverStation.getGameData();
|
||||
assertTrue(gameData.isPresent());
|
||||
assertEquals(message, gameData.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSetGameDataEmpty() {
|
||||
HAL.initialize(500, 0);
|
||||
DriverStationSim.resetData();
|
||||
|
||||
DriverStationSim.setGameData("");
|
||||
DriverStationSim.notifyNewData();
|
||||
assertTrue(DriverStation.getGameData().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSetGameDataNull() {
|
||||
HAL.initialize(500, 0);
|
||||
DriverStationSim.resetData();
|
||||
|
||||
DriverStationSim.setGameData(null);
|
||||
DriverStationSim.notifyNewData();
|
||||
assertTrue(DriverStation.getGameData().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user