From 7f55b2623d0856dfa3359d7a60ac699eb47cf0ac Mon Sep 17 00:00:00 2001 From: MEFThunders7035 <157488669+MEFThunders7035@users.noreply.github.com> Date: Mon, 26 Feb 2024 23:07:28 +0300 Subject: [PATCH] add a test for sparkWrapper --- src/test/java/SparkMAXWrapperTest.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/java/SparkMAXWrapperTest.java diff --git a/src/test/java/SparkMAXWrapperTest.java b/src/test/java/SparkMAXWrapperTest.java new file mode 100644 index 0000000..b099f97 --- /dev/null +++ b/src/test/java/SparkMAXWrapperTest.java @@ -0,0 +1,24 @@ +import static org.junit.jupiter.api.Assertions.assertEquals; + +import edu.wpi.first.hal.HAL; +import frc.utils.sim_utils.CANSparkMAXWrapped; +import frc.utils.sim_utils.SparkMAXSimAddon; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class SparkMAXWrapperTest { + @BeforeEach + public void setUp() { + HAL.initialize(500, 0); // init HAL just in case + } + + @Test + void testSparkMAXWrapper() { + for (int i = 0; i < 50; i++) { + CANSparkMAXWrapped sparkMAX = + new CANSparkMAXWrapped(i, CANSparkMAXWrapped.MotorType.kBrushless); + assertEquals(sparkMAX, SparkMAXSimAddon.getSparkMAX(i)); + sparkMAX.close(); + } + } +}