aboutsummaryrefslogtreecommitdiff
path: root/tests/combined.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-05 17:15:19 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-05 17:15:19 +0100
commitef75681956ae842cbf1b2b357374aa34e3361448 (patch)
treebfffc2171fc242a35b105fafd2198bc7bdd1fc04 /tests/combined.cpp
parentbebbc7982482a2271096ef53c778cd93a4bbff7a (diff)
Add GotoNextGame() function to skip an entire game
Diffstat (limited to 'tests/combined.cpp')
-rw-r--r--tests/combined.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/combined.cpp b/tests/combined.cpp
index 219d432..a4b2089 100644
--- a/tests/combined.cpp
+++ b/tests/combined.cpp
@@ -89,4 +89,32 @@ TEST_CASE("Kramnik PGN", "[combined/kramnik]") {
pgn.GetMoves(m);
CHECK(m->comment == "E32: Nimzo-Indian: Classical (4 Qc2): 4...0-0");
}
-} \ No newline at end of file
+}
+
+TEST_CASE("Goto Next Game Tests", "[combined/hartwig/GotoNextGame]") {
+ // PGN source: https://www.angelfire.com/games3/smartbridge/
+
+ pgnp::PGN pgn;
+ pgn.FromFile("pgn_files/combined/hartwig.pgn");
+ // First goto game 3
+ pgn.GotoNextGame();
+ pgn.GotoNextGame();
+ // Parse game 3
+ pgn.ParseNextGame();
+ CHECK(pgn.GetTagValue("Event") == "Clichy");
+ // Goto game 5
+ pgn.GotoNextGame();
+ // Parse game 5
+ pgn.ParseNextGame();
+ CHECK(pgn.GetTagValue("Event") == "World Open U2200");
+ CHECK(pgn.GetTagValue("Site") == "Philadelphia");
+ CHECK(pgn.GetTagValue("Black") == "Thomas, Rodney");
+ // Goto game 8
+ pgn.GotoNextGame(); // Goto game 7
+ pgn.GotoNextGame(); // Goto game 8
+ // Parse game 8
+ pgn.ParseNextGame();
+ CHECK(pgn.GetTagValue("Event") == "Hastings");
+ CHECK(pgn.GetTagValue("White") == "Plaskett, James");
+ CHECK(pgn.GetTagValue("Black") == "Shipov, Sergei");
+}