mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpimath] Use UtilityClassTest for more utility classes (#5384)
This commit is contained in:
@@ -11,9 +11,14 @@ import edu.wpi.first.math.geometry.Rotation3d;
|
||||
import edu.wpi.first.math.geometry.Transform3d;
|
||||
import edu.wpi.first.math.geometry.Translation3d;
|
||||
import edu.wpi.first.math.util.Units;
|
||||
import edu.wpi.first.wpilibj.UtilityClassTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ComputerVisionUtilTest {
|
||||
class ComputerVisionUtilTest extends UtilityClassTest<ComputerVisionUtil> {
|
||||
ComputerVisionUtilTest() {
|
||||
super(ComputerVisionUtil.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testObjectToRobotPose() {
|
||||
var robot = new Pose3d(1.0, 2.0, 0.0, new Rotation3d(0.0, 0.0, Units.degreesToRadians(30.0)));
|
||||
|
||||
@@ -6,10 +6,15 @@ package edu.wpi.first.math;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import edu.wpi.first.wpilibj.UtilityClassTest;
|
||||
import org.ejml.simple.SimpleMatrix;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class DARETest {
|
||||
class DARETest extends UtilityClassTest<DARE> {
|
||||
DARETest() {
|
||||
super(DARE.class);
|
||||
}
|
||||
|
||||
public static void assertMatrixEqual(SimpleMatrix A, SimpleMatrix B) {
|
||||
for (int i = 0; i < A.numRows(); i++) {
|
||||
for (int j = 0; j < A.numCols(); j++) {
|
||||
|
||||
@@ -6,9 +6,14 @@ package edu.wpi.first.math;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import edu.wpi.first.wpilibj.UtilityClassTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class MathUtilTest {
|
||||
class MathUtilTest extends UtilityClassTest<MathUtil> {
|
||||
MathUtilTest() {
|
||||
super(MathUtil.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testApplyDeadbandUnityScale() {
|
||||
// < 0
|
||||
|
||||
@@ -12,13 +12,18 @@ import edu.wpi.first.math.geometry.Pose2d;
|
||||
import edu.wpi.first.math.geometry.Rotation2d;
|
||||
import edu.wpi.first.math.numbers.N1;
|
||||
import edu.wpi.first.math.numbers.N2;
|
||||
import edu.wpi.first.wpilibj.UtilityClassTest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.ejml.dense.row.MatrixFeatures_DDRM;
|
||||
import org.ejml.simple.SimpleMatrix;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class StateSpaceUtilTest {
|
||||
class StateSpaceUtilTest extends UtilityClassTest<StateSpaceUtil> {
|
||||
StateSpaceUtilTest() {
|
||||
super(StateSpaceUtil.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCostArray() {
|
||||
var mat = StateSpaceUtil.makeCostMatrix(VecBuilder.fill(1.0, 2.0, 3.0));
|
||||
|
||||
Reference in New Issue
Block a user