Example #1
0
  @Test
  public void shouldCaptureManyEnemies() {
    // given
    givenFl("☼☼☼☼☼" + "☼  ☻☼" + "☼   ☼" + "☼☺  ☼" + "☼☼☼☼☼");

    joystick2.act(3, 3);
    joystick2.down();
    game.tick();
    joystick2.act(3, 2);
    joystick2.down();
    game.tick();

    assertE("☼☼☼☼☼" + "☼  ☻☼" + "☼  ☻☼" + "☼☺ ☻☼" + "☼☼☼☼☼");

    // when
    joystick2.act(3, 3);
    joystick2.left();

    joystick1.act(1, 1);
    joystick1.right();
    game.tick();

    // then
    assertE("☼☼☼☼☼" + "☼ ☻☻☼" + "☼  ☺☼" + "☼☺☺☺☼" + "☼☼☼☼☼");
  }
Example #2
0
  @Test
  public void shouldSecondPlayerMoveDownAndFirstUp() {
    givenFl("☼☼☼☼☼" + "☼  ☻☼" + "☼   ☼" + "☼☺  ☼" + "☼☼☼☼☼");

    joystick2.act(3, 3);
    joystick2.down();
    game.tick();

    assertE("☼☼☼☼☼" + "☼  ☻☼" + "☼  ☻☼" + "☼☺  ☼" + "☼☼☼☼☼");

    joystick1.act(1, 1);
    joystick1.up();
    game.tick();

    assertE("☼☼☼☼☼" + "☼  ☻☼" + "☼☺ ☻☼" + "☼☺  ☼" + "☼☼☼☼☼");
  }
Example #3
0
  @Test
  public void shouldSplitLeftAndRight() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(2, 2);
    joystick1.left();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼☺☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(2, 2);
    joystick1.right();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼☺☺☺☼" + "☼   ☼" + "☼☼☼☼☼");
  }
Example #4
0
  @Test
  public void shouldHitTheWall() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(2, 2);
    joystick1.left();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼☺☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(1, 2);
    joystick1.left();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼☺☺ ☼" + "☼   ☼" + "☼☼☼☼☼");
  }
Example #5
0
  @Test
  public void shouldSplitLeftThenUp() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(2, 2);
    joystick1.left();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼☺☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(1, 2);
    joystick1.up();
    game.tick();

    assertE("☼☼☼☼☼" + "☼☺  ☼" + "☼☺☺ ☼" + "☼   ☼" + "☼☼☼☼☼");
  }
Example #6
0
  @Test
  public void shouldTwoPlayersOnBoard() {
    givenFl("☼☼☼☼☼" + "☼  ☻☼" + "☼   ☼" + "☼☺  ☼" + "☼☼☼☼☼");

    game.tick();

    assertE("☼☼☼☼☼" + "☼  ☻☼" + "☼   ☼" + "☼☺  ☼" + "☼☼☼☼☼");
  }
Example #7
0
  @Test
  public void shouldFieldAtStart() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");
  }
Example #8
0
  @Test
  public void shouldHitTheHero() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(2, 2);
    joystick1.left();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼☺☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(1, 2);
    joystick1.right();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼☺☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    assertEquals(2, player1.heroes.size());
  }
Example #9
0
  @Test
  public void shouldSplitUpWhenGoUp() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(2, 2);
    joystick1.up();
    game.tick();

    assertE("☼☼☼☼☼" + "☼ ☺ ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");
  }
Example #10
0
  @Test
  public void shouldKillWhenPlayerMoveTowardsStanding() {
    // given
    givenFl("☼☼☼☼☼" + "☼  ☻☼" + "☼   ☼" + "☼☺  ☼" + "☼☼☼☼☼");

    joystick2.act(3, 3);
    joystick2.down();
    game.tick();

    assertE("☼☼☼☼☼" + "☼  ☻☼" + "☼  ☻☼" + "☼☺  ☼" + "☼☼☼☼☼");

    // when
    joystick1.act(1, 1);
    joystick1.right();
    game.tick();

    // then
    assertE("☼☼☼☼☼" + "☼  ☻☼" + "☼  ☺☼" + "☼☺☺ ☼" + "☼☼☼☼☼");
  }
Example #11
0
  @Test
  public void shouldSplitDownWhenGoDown() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(2, 2);
    joystick1.down();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼ ☺ ☼" + "☼☼☼☼☼");
  }
Example #12
0
  @Test
  public void shouldNotPickEmptyField() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");

    joystick1.act(1, 1);

    joystick1.up();
    game.tick();

    joystick1.down();
    game.tick();

    joystick1.left();
    game.tick();

    joystick1.right();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼☼☼☼☼");
  }
Example #13
0
  @Test
  public void shouldDoNothingWhenTwoPlayersMoveTowardsEachOther2() {
    givenFl("☼☼☼☼☼☼" + "☼☻   ☼" + "☼    ☼" + "☼    ☼" + "☼☺   ☼" + "☼☼☼☼☼☼");

    joystick1.act(1, 1);
    joystick1.up();
    joystick2.act(1, 4);
    joystick2.down();
    game.tick();

    assertE("☼☼☼☼☼☼" + "☼☻   ☼" + "☼☻   ☼" + "☼☺   ☼" + "☼☺   ☼" + "☼☼☼☼☼☼");
  }
Example #14
0
  @Test
  public void shouldDoNothingWhenTwoPlayersMoveTowardsEachOtherWhenBadY() {
    givenFl("☼☼☼☼☼" + "☼☻  ☼" + "☼   ☼" + "☼☺  ☼" + "☼☼☼☼☼");

    joystick1.act(1, 1);
    joystick1.right();
    joystick2.act(1, 3);
    joystick2.right();
    game.tick();

    assertE("☼☼☼☼☼" + "☼☻☻ ☼" + "☼   ☼" + "☼☺☺ ☼" + "☼☼☼☼☼");
  }
Example #15
0
  @Test
  public void shouldAnnigilateWhenTwoPlayersMoveTowardsEachOther() {
    givenFl("☼☼☼☼☼" + "☼   ☼" + "☼  ☻☼" + "☼☺  ☼" + "☼☼☼☼☼");

    joystick1.act(1, 1);
    joystick1.right();
    joystick2.act(3, 2);
    joystick2.left();
    game.tick();

    assertE("☼☼☼☼☼" + "☼   ☼" + "☼ ☻☻☼" + "☼☺☺ ☼" + "☼☼☼☼☼");
  }
Example #16
0
  @Test
  public void shouldNotMoveOnTheSamePlace() {
    givenFl("☼☼☼☼☼" + "☼  ☻☼" + "☼   ☼" + "☼  ☺☼" + "☼☼☼☼☼");

    joystick2.act(3, 3);
    joystick2.down();
    joystick1.act(3, 1);
    joystick1.up();
    game.tick();

    assertE("☼☼☼☼☼" + "☼  ☻☼" + "☼  ☼☼" + "☼  ☺☼" + "☼☼☼☼☼");

    assertEquals(1, player1.getHeroes().size());
    assertEquals(1, player2.getHeroes().size());
  }
Example #17
0
  // нельзя ходить по другим игрокам
  @Test
  public void shouldNoWayAtHero() {
    count = 3;
    givenDice(0, 0, 0, 1, 0, 2);
    givenGame();

    assertF("     " + "     " + "♥    " + "☻    " + "☺    ");

    // when
    Player player = hex.getPlayers().get(1);
    Joystick joystick = player.getJoystick();
    joystick.act(0, 1); // ☻
    joystick.up();
    hex.tick();

    // then
    assertF("     " + "     " + "♥    " + "☻    " + "☺    ");

    verifyNoMoreInteractions(listener);
  }