diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-01-26 18:36:48 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-01-26 18:36:48 +0100 |
| commit | 0fa6b682f5fcc63d3b212eeb52d998d0e33062ba (patch) | |
| tree | c92e657a30a42519eafa38b4b2fb7e87b06728fa | |
| parent | 5de6bf399bcc13425829d196a566c609a7b325ac (diff) | |
Debug and Improve tests:
- Debug missing NAG in HalfMove Copy function
- Improve combined tests
| -rw-r--r-- | src/HalfMove.cpp | 1 | ||||
| -rw-r--r-- | tests/combined.cpp | 26 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/HalfMove.cpp b/src/HalfMove.cpp index 7cf3f64..1375b25 100644 --- a/src/HalfMove.cpp +++ b/src/HalfMove.cpp @@ -50,6 +50,7 @@ void HalfMove::Copy(HalfMove *copy) { copy->isBlack = isBlack; copy->move = move; copy->comment = comment; + copy->NAG = NAG; // Copy MainLine if (MainLine != NULL) { diff --git a/tests/combined.cpp b/tests/combined.cpp index b9d18d4..219d432 100644 --- a/tests/combined.cpp +++ b/tests/combined.cpp @@ -22,7 +22,7 @@ TEST_CASE("Hartwig PGN", "[combined/hartwig]") { } }()); - SECTION("Check comments of a game") { + SECTION("Check comments of a game 5") { pgnp::PGN pgn; pgn.FromFile("pgn_files/combined/hartwig.pgn"); pgn.ParseNextGame(); @@ -33,12 +33,31 @@ TEST_CASE("Hartwig PGN", "[combined/hartwig]") { HalfMove *m = new HalfMove(); pgn.GetMoves(m); - std::cout << m->comment; CHECK(m->comment == "I had actually prepared 1.d4 for the tournament, but I backed out " "in every (!) game for various different reasons. In this case it " "was because things were in such a rut I would only be cheered by " "winning in crushing style. Thankfully it worked!"); + + HalfMove *m13b = (m->GetHalfMoveAt(25)); // move 13 black => m13b + CHECK(m13b->comment == + "Definitely the most resiliant. My memory did not serve here so we " + "were both on our own, but I used the process of elimination to " + "guide me through the next couple moves, knowing the resulting " + "position should be winning for white."); + REQUIRE(m13b->variations.size() == 3); + CHECK((m13b->variations[1])->comment == + "just loses thanks to the interpolation of 11. c3 fxe4:"); + + HalfMove *m20w = (m->GetHalfMoveAt(38)); // move 20 white => m20w + CHECK(m20w->NAG == "$1"); + + HalfMove *m21b = (m->GetHalfMoveAt(42)); // move 21 black => m21b + CHECK(m21b->comment == + "After black resigned a spectator, who had been playing his own game " + "one board down, shook my hand. I was quite cheered up, but still I " + "had to wonder, with the advanced state of theory these days, if " + "this whole game might not have been played before by someone else."); } } @@ -68,7 +87,6 @@ TEST_CASE("Kramnik PGN", "[combined/kramnik]") { HalfMove *m = new HalfMove(); pgn.GetMoves(m); - CHECK(m->comment == - "E32: Nimzo-Indian: Classical (4 Qc2): 4...0-0"); + CHECK(m->comment == "E32: Nimzo-Indian: Classical (4 Qc2): 4...0-0"); } }
\ No newline at end of file |
