Пример #1
0
  @Test(expected = IllegalArgumentException.class)
  public void createAssignmentIllegal() throws IllegalArgumentException {
    Statement a1 = f.createAssignment("test", new True(), null);
    Statement a2 = f.createAssignment("test", new HerePosition(), null);
    Statement s = f.createSequence(Arrays.asList(a1, a2), null);

    runStatementFor(u, s, 0.2);
  }
Пример #2
0
  @Test
  public void createAssignment() throws Exception {
    Statement a = f.createAssignment("assignment", new True(), null);

    runStatementFor(u, a, 0.2); // No exceptions

    // Check whether task successfully finished
    assertEquals(null, u.getTask());
    assertEquals(0, u.getFaction().getScheduler().getNbTasks());
  }
Пример #3
0
  @Test
  public void createReadVariable() throws Exception {
    Statement stmt =
        f.createSequence(
            Arrays.asList(
                f.createAssignment("w", new True(), null),
                new Print(f.createReadVariable("w", null))),
            null);

    runStatementFor(u, stmt, 0.2);
    System.out.println("The above should print True");

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