コード例 #1
0
  @Test
  public void testExplorerPositionZeroAndZeroOrientationNorth() {
    PlanetExplorer pe = new PlanetExplorer(100, 100, "");

    boolean expected = (new int[] {0, 0}).equals(new int[] {0, 0}) & "N".equals("N");
    boolean actual =
        (new int[] {0, 0}).equals(pe.getPositionXY()) & pe.getOrientation().equals("N");

    assertEquals(expected, actual);
  }
コード例 #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 testMoveRightExplorerOrientationEast() {
    PlanetExplorer pe = new PlanetExplorer(100, 100, "");

    pe.executeCommand("r");

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

    assertEquals(expected, actual);
  }