aboutsummaryrefslogtreecommitdiff
path: root/tests/combined.cpp
diff options
context:
space:
mode:
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