aboutsummaryrefslogtreecommitdiff
path: root/tests/combined.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-01-26 15:02:15 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-01-26 15:02:15 +0100
commita1f2467a87f5ce6b0841b2f0d9dc80a26b689147 (patch)
tree56a653dbabea84c8dda9c2259dc9ddd554cbf001 /tests/combined.cpp
parentf4f436870f9ce0368d81c504e93b012e3928a851 (diff)
Debug and new tests:
- Fix HalfMove memory leak - Fix integer overflow - Update combined tests
Diffstat (limited to 'tests/combined.cpp')
-rw-r--r--tests/combined.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/combined.cpp b/tests/combined.cpp
index 4f1db7d..b9d18d4 100644
--- a/tests/combined.cpp
+++ b/tests/combined.cpp
@@ -40,4 +40,35 @@ TEST_CASE("Hartwig PGN", "[combined/hartwig]") {
"was because things were in such a rut I would only be cheered by "
"winning in crushing style. Thankfully it worked!");
}
+}
+
+TEST_CASE("Kramnik PGN", "[combined/kramnik]") {
+ // PGN source: https://www.angelfire.com/games3/smartbridge/
+
+ pgnp::PGN pgn;
+ pgn.FromFile("pgn_files/combined/kramnik.pgn");
+
+ // Count games
+ REQUIRE_NOTHROW([&]() {
+ char i = 0;
+ try {
+ while (true) {
+ pgn.ParseNextGame();
+ i++;
+ }
+ } catch (const NoGameFound &e) {
+ CHECK(i == 40);
+ }
+ }());
+
+ SECTION("Check comments of a game") {
+ pgnp::PGN pgn;
+ pgn.FromFile("pgn_files/combined/kramnik.pgn");
+ pgn.ParseNextGame(); // Load game 1
+
+ HalfMove *m = new HalfMove();
+ pgn.GetMoves(m);
+ CHECK(m->comment ==
+ "E32: Nimzo-Indian: Classical (4 Qc2): 4...0-0");
+ }
} \ No newline at end of file