From ef75681956ae842cbf1b2b357374aa34e3361448 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 5 Jan 2023 17:15:19 +0100 Subject: Add GotoNextGame() function to skip an entire game --- tests/combined.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'tests/combined.cpp') 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"); +} -- cgit v1.2.3