From: GLRoylance Date: Sat, 14 Feb 2026 23:01:14 +0000 (-0800) Subject: Clean up unit test (no print statements / add comments). X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=ab5bc3695c840683f42ea107550a7702d6863ff8;p=FRC2026.git Clean up unit test (no print statements / add comments). --- diff --git a/src/test/java/frc/robot/subsystems/Intake/IntakeTest.java b/src/test/java/frc/robot/subsystems/Intake/IntakeTest.java index af5e271..fe406cf 100644 --- a/src/test/java/frc/robot/subsystems/Intake/IntakeTest.java +++ b/src/test/java/frc/robot/subsystems/Intake/IntakeTest.java @@ -13,16 +13,22 @@ public class IntakeTest { intake.close(); } + /** + * Test the rotations to inches and inches to rotations conversion functions. + * Assumes a gear ratio of 36:12 (= 3). + * Assumes a 10DP rack and a 10-tooth rack pinion. + */ @Test public void conversionTest() { - System.out.println("rotations to inches: " + intake.rotationsToInches(3.0)); + // 3 motor rotations will turn the rack pinion once. + // That will advance the rack 10 teeth. + // linear distance will be pi * 10 / 10 = pi. assertEquals(Math.PI, intake.rotationsToInches(3.0), 0.0001); - System.out.println("2: inches to rotations: " + intake.inchesToRotations(Math.PI)); - + // traveling pi inches should take 3 motor turns assertEquals(3.0, intake.inchesToRotations(3.14159), 0.0001); + // the methods should be inverses of each other assertEquals(15.0, intake.rotationsToInches(intake.inchesToRotations(15.0)), 0.0001); } - }