You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

  1. package Game;
  2. import org.junit.jupiter.api.AfterEach;
  3. import org.junit.jupiter.api.BeforeEach;
  4. import org.junit.jupiter.api.Test;
  5. import static org.junit.jupiter.api.Assertions.assertArrayEquals;
  6. import static org.junit.jupiter.api.Assertions.assertNull;
  7. class ChessTest {
  8. Chess chess;
  9. @BeforeEach
  10. void setUp() {
  11. chess = new Chess();
  12. }
  13. @AfterEach
  14. void tearDown() {
  15. }
  16. @Test
  17. void convertInput() {
  18. int[] test1 = {0, 0};
  19. int[] test2 = {7, 7};
  20. int[] test3 = {6, 2};
  21. assertNull(chess.convertInput("0g2"));
  22. assertNull(chess.convertInput("25"));
  23. assertNull(chess.convertInput("bg"));
  24. assertNull(chess.convertInput("9b"));
  25. assertNull(chess.convertInput("2i"));
  26. assertArrayEquals(chess.convertInput("1a"), test1);
  27. assertArrayEquals((chess.convertInput("a1")), test1);
  28. assertArrayEquals((chess.convertInput("8h")), test2);
  29. assertArrayEquals((chess.convertInput("h8")), test2);
  30. assertArrayEquals((chess.convertInput("3G")), test3);
  31. assertArrayEquals((chess.convertInput("G3")), test3);
  32. }
  33. }