Esempio n. 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);
  }
Esempio n. 2
0
  @Test
  public void createSequence() throws Exception {
    Statement sequence =
        f.createSequence(Arrays.asList(new Print(new True()), new Print(new False())), null);

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

    // Check whether task successfully finished
    assertEquals(null, u.getTask());
    assertEquals(0, u.getFaction().getScheduler().getNbTasks());
  }
Esempio n. 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());
  }