[wpimath] Prevent CoordinateSystem from accepting left-handed systems (#8750)

This commit is contained in:
Tricks1228
2026-04-11 15:53:36 -05:00
committed by GitHub
parent c6f54e963c
commit 042567d0ba
4 changed files with 45 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
package org.wpilib.math.geometry;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import org.wpilib.math.util.Units;
@@ -232,4 +233,17 @@ class CoordinateSystemTest {
CoordinateSystem.EDN(),
CoordinateSystem.NED());
}
@Test
void testLeftHandedSystemThrowsException() {
assertThrows(
IllegalArgumentException.class,
() -> new CoordinateSystem(CoordinateAxis.N(), CoordinateAxis.E(), CoordinateAxis.U()));
assertThrows(
IllegalArgumentException.class,
() -> new CoordinateSystem(CoordinateAxis.E(), CoordinateAxis.U(), CoordinateAxis.N()));
assertThrows(
IllegalArgumentException.class,
() -> new CoordinateSystem(CoordinateAxis.N(), CoordinateAxis.W(), CoordinateAxis.D()));
}
}