mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Add sim hooks to set match data (#1191)
This commit is contained in:
committed by
Peter Johnson
parent
c25d48fd0c
commit
eb2c6e19f8
@@ -9,13 +9,28 @@ package edu.wpi.first.wpilibj.hal;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import edu.wpi.first.hal.sim.mockdata.DriverStationDataJNI;
|
||||
import edu.wpi.first.wpilibj.DriverStation.MatchType;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class MatchInfoDataTest {
|
||||
@Test
|
||||
@SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert")
|
||||
void matchInfoDataDoesNotThrow() {
|
||||
HAL.initialize(500, 0);
|
||||
MatchInfoData data = new MatchInfoData();
|
||||
HAL.getMatchInfo(data);
|
||||
// Nothing we can assert, so just make sure it didn't throw.
|
||||
void testSetMatchInfo() {
|
||||
|
||||
MatchType matchType = MatchType.Qualification;
|
||||
DriverStationDataJNI.setMatchInfo("Event Name", "Game Message", 174, 191, matchType.ordinal());
|
||||
|
||||
MatchInfoData outMatchInfo = new MatchInfoData();
|
||||
HAL.getMatchInfo(outMatchInfo);
|
||||
|
||||
assertAll(
|
||||
() -> assertEquals("Event Name", outMatchInfo.eventName),
|
||||
() -> assertEquals(matchType.ordinal(), outMatchInfo.matchType),
|
||||
() -> assertEquals(174, outMatchInfo.matchNumber),
|
||||
() -> assertEquals(191, outMatchInfo.replayNumber),
|
||||
() -> assertEquals("Game Message", outMatchInfo.gameSpecificMessage)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user