mirror of
https://gitlab.com/manzerbredes/pgnp.git
synced 2025-04-19 03:49:43 +00:00
Debug and new tests:
- Fix HalfMove memory leak - Fix integer overflow - Update combined tests
This commit is contained in:
parent
f4f436870f
commit
a1f2467a87
4 changed files with 1367 additions and 1 deletions
|
@ -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");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue