-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added switching between file-only and nt + file-only logging dependin…
…g on fms
- Loading branch information
Showing
7 changed files
with
93 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package frc.robot; | ||
|
||
import static frc.lib.UnitTestingUtil.*; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import dev.doglog.DogLog; | ||
import edu.wpi.first.epilogue.Epilogue; | ||
import edu.wpi.first.epilogue.logging.FileLogger; | ||
import edu.wpi.first.epilogue.logging.MultiLogger; | ||
import edu.wpi.first.wpilibj.DriverStation; | ||
import edu.wpi.first.wpilibj.simulation.DriverStationSim; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class RobotTest { | ||
private Robot _robot; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
setupTests(); | ||
|
||
_robot = new Robot(getNtInst()); | ||
} | ||
|
||
@AfterEach | ||
public void close() throws Exception { | ||
reset(_robot); | ||
} | ||
|
||
@Test | ||
public void fmsFileOnly() { | ||
// at the start should be both nt and file logging | ||
assert Epilogue.getConfig().dataLogger instanceof MultiLogger; // multilogger setup | ||
assert DogLog.getOptions().ntPublish(); | ||
|
||
DriverStationSim.setFmsAttached(true); | ||
DriverStationSim.notifyNewData(); | ||
|
||
assert DriverStation.isFMSAttached(); | ||
|
||
_robot.robotPeriodic(); | ||
|
||
// once the fms connects, it should be file only | ||
assert Epilogue.getConfig().dataLogger instanceof FileLogger; | ||
assertFalse(DogLog.getOptions().ntPublish()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters