[wpilib] Add EventLoop (#4104)

This is a generic expansion of the command-based Trigger framework.
This commit is contained in:
Starlight220
2022-06-09 08:16:51 +03:00
committed by GitHub
parent 16a4888c52
commit 45b7fc445b
27 changed files with 1265 additions and 428 deletions

View File

@@ -20,7 +20,7 @@ public class CommandTestBase {
void commandSetup() {
CommandScheduler.getInstance().cancelAll();
CommandScheduler.getInstance().enable();
CommandScheduler.getInstance().clearButtons();
CommandScheduler.getInstance().getActiveButtonLoop().clear();
CommandGroupBase.clearGroupedCommands();
setDSEnabled(true);

View File

@@ -170,10 +170,10 @@ class ButtonTest extends CommandTestBase {
button1.setPressed(true);
button2.setPressed(false);
assertFalse(button1.and(button2).get());
assertTrue(button1.or(button2).get());
assertFalse(button1.negate().get());
assertTrue(button1.and(button2.negate()).get());
assertFalse(button1.and(button2).getAsBoolean());
assertTrue(button1.or(button2).getAsBoolean());
assertFalse(button1.negate().getAsBoolean());
assertTrue(button1.and(button2.negate()).getAsBoolean());
}
@Test
@@ -183,8 +183,8 @@ class ButtonTest extends CommandTestBase {
button1.setPressed(true);
assertFalse(button1.and(booleanSupplier).get());
assertTrue(button1.or(booleanSupplier).get());
assertFalse(button1.and(booleanSupplier).getAsBoolean());
assertTrue(button1.or(booleanSupplier).getAsBoolean());
}
@Test