Beispiel #1
0
  /** Tests the 4-move solution to the water jug problem */
  @Test
  public void testSolution1() {
    assertFalse(problem.success());
    tryMove(m1);

    assertFalse(problem.success());
    tryMove(m5);

    assertFalse(problem.success());
    tryMove(m1);

    assertFalse(problem.success());
    tryMove(m5);
    assertTrue(problem.success());
  }
Beispiel #2
0
  /** Tests the 6-move solution to the water jug problem */
  @Test
  public void testSolution2() {
    assertFalse(problem.success());
    tryMove(m2);

    assertFalse(problem.success());
    tryMove(m6);

    assertFalse(problem.success());
    tryMove(m3);

    assertFalse(problem.success());
    tryMove(m6);

    assertFalse(problem.success());
    tryMove(m2);

    assertFalse(problem.success());
    tryMove(m6);

    assertTrue(problem.success());
  }