Added PGNDatabaseTest and test file
This commit is contained in:
parent
258db80f36
commit
e4daec64b1
36
test/dev/kske/chess/pgn/PGNDatabaseTest.java
Normal file
36
test/dev/kske/chess/pgn/PGNDatabaseTest.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package dev.kske.chess.pgn;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import dev.kske.chess.exception.ChessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: <strong>Chess</strong><br>
|
||||||
|
* File: <strong>PGNDatabaseTest.java</strong><br>
|
||||||
|
* Created: <strong>4 Oct 2019</strong><br>
|
||||||
|
* Author: <strong>Kai S. K. Engelbart</strong>
|
||||||
|
*/
|
||||||
|
class PGNDatabaseTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test method for {@link dev.kske.chess.pgn.PGNDatabase#load(java.io.File)}.
|
||||||
|
*
|
||||||
|
* @throws ChessException
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
void testLoad() {
|
||||||
|
PGNDatabase db = new PGNDatabase();
|
||||||
|
try {
|
||||||
|
db.load(new File(getClass().getClassLoader().getResource("test.pgn").getFile()));
|
||||||
|
} catch (FileNotFoundException | ChessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
fail(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
test_res/test.pgn
Normal file
18
test_res/test.pgn
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[Event "Test Game"]
|
||||||
|
[Site "Test Environment"]
|
||||||
|
[Date "2019.10.04"]
|
||||||
|
[Round "1"]
|
||||||
|
[Result "1-0"]
|
||||||
|
[White "Kai Engelbart"]
|
||||||
|
[Black "Kai Engelbart 2"]
|
||||||
|
|
||||||
|
1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 a6 5. Bd3 Nf6 6. O-O d6
|
||||||
|
7. c4 Bd7 8. Nc3 Nc6 9. Be3 Be7 10. h3 Ne5 11. Be2 Rc8 12. Qb3
|
||||||
|
Qc7 13. Rac1 O-O 14. f4 Nc6 15. Nf3 Qb8 16. Qd1 Be8 17. Qd2
|
||||||
|
Na5 18. b3 b6 19. Bd3 Nc6 20. Qf2 b5 21. Rfd1 Nb4 22. Bf1 bxc4
|
||||||
|
23. bxc4 a5 24. Nd4 Qa8 25. Qf3 Na6 26. Ndb5 Nc5 27. e5 dxe5
|
||||||
|
28. Qxa8 Rxa8 29. fxe5 Nfe4 30. Nd6 Bc6 31. Ncxe4 Nxe4 32. c5
|
||||||
|
Ng3 33. Bc4 h5 34. Bf2 h4 35. Bxg3 hxg3 36. Bb5 Bxb5 37. Nxb5
|
||||||
|
f6 38. Rd7 Bd8 39. Rc3 fxe5 40. Rxg3 Rf7 41. Rxf7 Kxf7 42. c6
|
||||||
|
Bb6+ 43. Kf1 Kf8 44. c7 Rc8 45. a4 e4 46. Ke2 e5 47. Rg6 Bd4
|
||||||
|
48. h4 Bb2 1-0
|
Reference in New Issue
Block a user