|
@ -0,0 +1,43 @@ |
|
|
|
|
|
package Game; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.AfterEach; |
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals; |
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNull; |
|
|
|
|
|
|
|
|
|
|
|
class ChessTest { |
|
|
|
|
|
|
|
|
|
|
|
Chess chess; |
|
|
|
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
|
|
void setUp() { |
|
|
|
|
|
chess = new Chess(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@AfterEach |
|
|
|
|
|
void tearDown() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void convertInput() { |
|
|
|
|
|
int[] test1 = {0, 0}; |
|
|
|
|
|
int[] test2 = {7, 7}; |
|
|
|
|
|
int[] test3 = {6, 2}; |
|
|
|
|
|
|
|
|
|
|
|
assertNull(chess.convertInput("0g2")); |
|
|
|
|
|
assertNull(chess.convertInput("25")); |
|
|
|
|
|
assertNull(chess.convertInput("bg")); |
|
|
|
|
|
assertNull(chess.convertInput("9b")); |
|
|
|
|
|
assertNull(chess.convertInput("2i")); |
|
|
|
|
|
|
|
|
|
|
|
assertArrayEquals(chess.convertInput("1a"), test1); |
|
|
|
|
|
assertArrayEquals((chess.convertInput("a1")), test1); |
|
|
|
|
|
assertArrayEquals((chess.convertInput("8h")), test2); |
|
|
|
|
|
assertArrayEquals((chess.convertInput("h8")), test2); |
|
|
|
|
|
|
|
|
|
|
|
assertArrayEquals((chess.convertInput("3G")), test3); |
|
|
|
|
|
assertArrayEquals((chess.convertInput("G3")), test3); |
|
|
|
|
|
} |
|
|
|
|
|
} |