public void execProgram(Command[] cmds) { for (int i = 0; i < cmds.Length; i += 1) { try { switch (cmds[i]) { case Command.TL: map.turnLeft(); motCtrl.turnLeft(); break; case Command.TR: map.turnRight(); motCtrl.turnRight(); break; case Command.A: map.advance(); motCtrl.advance(); break; case Command.B: map.back(); motCtrl.back(); break; case Command.C: map.clean(); motCtrl.clean(); break; } } catch (CannotComplyException) { execBackoff(); if (error) { // All backoff strategies had failed. Execution finished return; } i -= 1; } catch (NotEnoughBatteryException) { return; } catch (OutOfBatteryException) { return; } catch (Exception) { error = true; } } }
public void clean_batteryDecrease5_return0() { proc.clean(); Assert.AreEqual(0, proc.Battery); }