Example #1
0
 @Test
 public void createTrue() throws Exception {
   System.out.println(u.getTask());
   Statement stmt = f.createPrint(f.createTrue(null), null);
   runStatementFor(u, stmt, 0.1);
   System.out.println("The above test should print 'true'");
 }
Example #2
0
  @Test
  public void createBreak() throws Exception {
    Expression<Boolean> condition = f.createTrue(null);
    Statement body = f.createIf(new CarriesItem(new This()), f.createBreak(null), null, null);
    Statement stmt = f.createWhile(condition, body, null);

    runStatementFor(u, stmt, 0.2);

    // Task is still running:
    assertTrue(u.getTask() != null);
    assertEquals(1, u.getFaction().getScheduler().getNbTasks());

    new Boulder(w, u);

    advanceTimeFor(w, 0.2);

    // Check whether task successfully finished
    assertEquals(null, u.getTask());
    assertEquals(0, u.getFaction().getScheduler().getNbTasks());
  }