public void run() {
TestCommand command1 = new TestCommand();
TestCommand command2 = new TestCommand();
CommandGroup commandGroup = new CommandGroup();
commandGroup.addParallel(command1);
commandGroup.addParallel(command2);
assertCommandState(command1, 0, 0, 0, 0, 0);
assertCommandState(command2, 0, 0, 0, 0, 0);
commandGroup.start();
assertCommandState(command1, 0, 0, 0, 0, 0);
assertCommandState(command2, 0, 0, 0, 0, 0);
Scheduler.getInstance().run();
assertCommandState(command1, 0, 0, 0, 0, 0);
assertCommandState(command2, 0, 0, 0, 0, 0);
Scheduler.getInstance().run();
assertCommandState(command1, 1, 1, 1, 0, 0);
assertCommandState(command2, 1, 1, 1, 0, 0);
Scheduler.getInstance().run();
assertCommandState(command1, 1, 2, 2, 0, 0);
assertCommandState(command2, 1, 2, 2, 0, 0);
command1.setHasFinished(true);
Scheduler.getInstance().run();
assertCommandState(command1, 1, 3, 3, 1, 0);
assertCommandState(command2, 1, 3, 3, 0, 0);
Scheduler.getInstance().run();
assertCommandState(command1, 1, 3, 3, 1, 0);
assertCommandState(command2, 1, 4, 4, 0, 0);
command2.setHasFinished(true);
Scheduler.getInstance().run();
assertCommandState(command1, 1, 3, 3, 1, 0);
assertCommandState(command2, 1, 5, 5, 1, 0);
}
CommandParallelGroupTest.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:wpilib-java
作者:
评论列表
文章目录