Commit a31f357c authored by Frederik Schwarzer's avatar Frederik Schwarzer

Refine tests.

parent f88dd6ae
......@@ -25,31 +25,37 @@ void MoveTest::initTestCase()
void MoveTest::x1() const
{
QCOMPARE(m_moveWithoutSlide.x1(), 1);
QCOMPARE(m_moveWithSlide.x1(), 5);
}
void MoveTest::y1() const
{
QCOMPARE(m_moveWithoutSlide.y1(), 2);
QCOMPARE(m_moveWithSlide.y1(), 6);
}
void MoveTest::x2() const
{
QCOMPARE(m_moveWithoutSlide.x2(), 3);
QCOMPARE(m_moveWithSlide.x2(), 7);
}
void MoveTest::y2() const
{
QCOMPARE(m_moveWithoutSlide.y2(), 4);
QCOMPARE(m_moveWithSlide.y2(), 8);
}
void MoveTest::tile1() const
{
QCOMPARE(m_moveWithoutSlide.tile1(), 12);
QCOMPARE(m_moveWithSlide.tile1(), 56);
}
void MoveTest::tile2() const
{
QCOMPARE(m_moveWithoutSlide.tile2(), 34);
QCOMPARE(m_moveWithSlide.tile2(), 78);
}
void MoveTest::hasSlide() const
......@@ -60,36 +66,47 @@ void MoveTest::hasSlide() const
void MoveTest::slideX1() const
{
QCOMPARE(m_moveWithSlide.slideX1(), 5);
QCOMPARE(m_moveWithoutSlide.slideX1(), -1);
QCOMPARE(m_moveWithSlide.slideX1(), 15);
}
void MoveTest::slideY1() const
{
QCOMPARE(m_moveWithSlide.slideY1(), 6);
QCOMPARE(m_moveWithoutSlide.slideY1(), -1);
QCOMPARE(m_moveWithSlide.slideY1(), 16);
}
void MoveTest::slideX2() const
{
QCOMPARE(m_moveWithSlide.slideX2(), 7);
QCOMPARE(m_moveWithoutSlide.slideX2(), -1);
QCOMPARE(m_moveWithSlide.slideX2(), 17);
}
void MoveTest::slideY2() const
{
QCOMPARE(m_moveWithSlide.slideY2(), 8);
QCOMPARE(m_moveWithoutSlide.slideY2(), -1);
QCOMPARE(m_moveWithSlide.slideY2(), 18);
}
void MoveTest::swapTiles()
{
auto move = KShisen::Move(m_tile1, m_tile2, 12, 34);
move.swapTiles();
QCOMPARE(move.x1(), 3);
QCOMPARE(move.y1(), 4);
QCOMPARE(move.tile1(), 34);
QCOMPARE(move.x2(), 1);
QCOMPARE(move.y2(), 2);
QCOMPARE(move.tile2(), 12);
m_moveWithoutSlide.swapTiles();
QCOMPARE(m_moveWithoutSlide.x1(), 3);
QCOMPARE(m_moveWithoutSlide.y1(), 4);
QCOMPARE(m_moveWithoutSlide.tile1(), 34);
QCOMPARE(m_moveWithoutSlide.x2(), 1);
QCOMPARE(m_moveWithoutSlide.y2(), 2);
QCOMPARE(m_moveWithoutSlide.tile2(), 12);
m_moveWithSlide.swapTiles();
QCOMPARE(m_moveWithSlide.x1(), 7);
QCOMPARE(m_moveWithSlide.y1(), 8);
QCOMPARE(m_moveWithSlide.tile1(), 78);
QCOMPARE(m_moveWithSlide.x2(), 5);
QCOMPARE(m_moveWithSlide.y2(), 6);
QCOMPARE(m_moveWithSlide.tile2(), 56);
}
void MoveTest::cleanupTestCase()
......
......@@ -48,8 +48,10 @@ private slots:
private:
KShisen::TilePos m_tile1{1, 2};
KShisen::TilePos m_tile2{3, 4};
KShisen::TilePos m_tile3{5, 6};
KShisen::TilePos m_tile4{7, 8};
KShisen::Move m_moveWithoutSlide{m_tile1, m_tile2, 12, 34};
KShisen::Move m_moveWithSlide{m_tile1, m_tile2, 12, 34, 5, 6, 7, 8};
KShisen::Move m_moveWithSlide{m_tile3, m_tile4, 56, 78, 15, 16, 17, 18};
};
#endif // MOVETEST_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment