From 5bcaf402675863c770b564340c61d798d938c4cd Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Tue, 31 Jul 2007 15:27:25 +0200 Subject: [PATCH] Added a simple SAN test. --- tests/hlvariants/chesswrappedtest.cpp | 7 +++++++ tests/hlvariants/chesswrappedtest.h | 2 ++ tests/hlvariants/prototype/chess/serializer.h | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/hlvariants/chesswrappedtest.cpp b/tests/hlvariants/chesswrappedtest.cpp index d271316..31e1756 100644 --- a/tests/hlvariants/chesswrappedtest.cpp +++ b/tests/hlvariants/chesswrappedtest.cpp @@ -60,5 +60,12 @@ void ChessWrappedTest::test_movable() { CPPUNIT_ASSERT_EQUAL(Premoving, m_pos->movable(test, Point(6, 0))); } +void ChessWrappedTest::test_san1() { + m_pos->setup(); + + MovePtr move(new HLVariant::WrappedMove(ChessMove(Point(4, 6), Point(4, 4)))); + CPPUNIT_ASSERT_EQUAL(QString("e4"), move->SAN(m_pos)); +} + diff --git a/tests/hlvariants/chesswrappedtest.h b/tests/hlvariants/chesswrappedtest.h index a634e45..9ab82f3 100644 --- a/tests/hlvariants/chesswrappedtest.h +++ b/tests/hlvariants/chesswrappedtest.h @@ -14,6 +14,7 @@ class ChessWrappedTest : public CppUnit::TestFixture { CPPUNIT_TEST(test_setup); CPPUNIT_TEST(test_move); CPPUNIT_TEST(test_movable); + CPPUNIT_TEST(test_san1); CPPUNIT_TEST_SUITE_END(); private: PositionPtr m_pos; @@ -24,6 +25,7 @@ public: void test_setup(); void test_move(); void test_movable(); + void test_san1(); }; #endif // CHESSWRAPPEDTEST_H diff --git a/tests/hlvariants/prototype/chess/serializer.h b/tests/hlvariants/prototype/chess/serializer.h index 9a84295..0b9c786 100644 --- a/tests/hlvariants/prototype/chess/serializer.h +++ b/tests/hlvariants/prototype/chess/serializer.h @@ -103,7 +103,8 @@ QString Serializer::san(const Move& move, const GameState& ref) { res = "O-O-O"; } else { - res = piece.typeName()[0].toUpper(); + if (piece.type() != Piece::PAWN) + res = piece.typeName()[0].toUpper(); SAN tmp; tmp.from = move.from(); -- 2.11.4.GIT