コード例 #1
0
 @Test
 public void testPlanetExplorerMoveForwardTwiceAndTurnRightThenMoveForwardTwiceAgainFromLanding() {
   PlanetExplorer planetExplorer = new PlanetExplorer(100, 100, "", "");
   String expectResult = planetExplorer.executeCommand("ffrff");
   System.out.println(expectResult);
   assertEquals("(102,102,E)", expectResult);
 }
コード例 #2
0
  @Test
  public void testTheConamiCodeOrientationNorth() {
    PlanetExplorer pe = new PlanetExplorer(100, 100, "");

    pe.executeCommand("up up down down left right left right b a - do the conami code");

    String expected = "N";
    String actual = pe.getOrientation();

    assertEquals(expected, actual);
  }
コード例 #3
0
  @Test
  public void testPositionZeroAndOne() {
    PlanetExplorer pe = new PlanetExplorer(100, 100, "");

    pe.executeCommand("rb");

    int[] expected = new int[] {0, 1};
    int[] actual = pe.getPositionXY();

    assertArrayEquals(expected, actual);
  }
コード例 #4
0
  @Test
  public void testMoveRightExplorerOrientationEast() {
    PlanetExplorer pe = new PlanetExplorer(100, 100, "");

    pe.executeCommand("r");

    String expected = "E";
    String actual = pe.getOrientation();

    assertEquals(expected, actual);
  }
コード例 #5
0
 @Test
 public void testPlanetLanding() {
   PlanetExplorer planetExplorer = new PlanetExplorer(100, 100, "", "");
   String expectResult = planetExplorer.executeCommand("");
   assertEquals("(100,100,N)", expectResult);
 }