[wpilibj] Add unit tests (#3501)

This commit is contained in:
PJ Reiniger
2021-08-12 02:04:14 -04:00
committed by GitHub
parent c159f91f06
commit e80f09f849
38 changed files with 2703 additions and 124 deletions

View File

@@ -70,10 +70,6 @@ public class DoubleSolenoid implements Sendable, AutoCloseable {
}
}
if (module.checkAndReserveSolenoids(m_mask) != 0) {
throw new AllocationException("Solenoid(s) already allocated");
}
HAL.report(
tResourceType.kResourceType_Solenoid, forwardChannel + 1, module.getModuleNumber() + 1);
HAL.report(

View File

@@ -32,7 +32,7 @@ public class PneumaticsControlModule implements PneumaticsBase, Sendable {
}
@Override
public void close() throws Exception {
public void close() {
CTREPCMJNI.free(m_handle);
SendableRegistry.remove(this);
}

View File

@@ -9,6 +9,7 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.hal.RelayJNI;
import edu.wpi.first.hal.util.HalHandleException;
import edu.wpi.first.hal.util.UncleanStatusException;
import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;
@@ -135,12 +136,12 @@ public class Relay extends MotorSafety implements Sendable, AutoCloseable {
private void freeRelay() {
try {
RelayJNI.setRelay(m_forwardHandle, false);
} catch (UncleanStatusException ignored) {
} catch (UncleanStatusException | HalHandleException ignored) {
// do nothing. Ignore
}
try {
RelayJNI.setRelay(m_reverseHandle, false);
} catch (UncleanStatusException ignored) {
} catch (UncleanStatusException | HalHandleException ignored) {
// do nothing. Ignore
}