Commit 194fc542 authored by Frederik Schwarzer's avatar Frederik Schwarzer
Browse files

Add tests for all methods.

parent 9d0c66f7
......@@ -20,10 +20,62 @@
void MoveTest::initTestCase()
{
qDebug("called before everything else");
}
void MoveTest::x1() const
{
QCOMPARE(m_moveWithoutSlide.x1(), 1);
}
void MoveTest::y1() const
{
QCOMPARE(m_moveWithoutSlide.y1(), 2);
}
void MoveTest::x2() const
{
QCOMPARE(m_moveWithoutSlide.x2(), 3);
}
void MoveTest::y2() const
{
QCOMPARE(m_moveWithoutSlide.y2(), 4);
}
void MoveTest::tile1() const
{
QCOMPARE(m_moveWithoutSlide.tile1(), 12);
}
m_tile1 = KShisen::TilePos(1, 2);
m_tile2 = KShisen::TilePos(3, 4);
void MoveTest::tile2() const
{
QCOMPARE(m_moveWithoutSlide.tile2(), 34);
}
void MoveTest::hasSlide() const
{
QCOMPARE(m_moveWithoutSlide.hasSlide(), false);
QCOMPARE(m_moveWithSlide.hasSlide(), true);
}
void MoveTest::slideX1() const
{
QCOMPARE(m_moveWithSlide.slideX1(), 5);
}
void MoveTest::slideY1() const
{
QCOMPARE(m_moveWithSlide.slideY1(), 6);
}
void MoveTest::slideX2() const
{
QCOMPARE(m_moveWithSlide.slideX2(), 7);
}
void MoveTest::slideY2() const
{
QCOMPARE(m_moveWithSlide.slideY2(), 8);
}
void MoveTest::swapTiles()
......@@ -42,7 +94,6 @@ void MoveTest::swapTiles()
void MoveTest::cleanupTestCase()
{
qDebug("called after myFirstTest and mySecondTest");
}
QTEST_MAIN(MoveTest)
......
......@@ -29,13 +29,27 @@ class MoveTest : public QObject
Q_OBJECT
private slots:
void initTestCase();
void x1() const;
void y1() const;
void x2() const;
void y2() const;
void tile1() const;
void tile2() const;
void hasSlide() const;
void slideX1() const;
void slideY1() const;
void slideX2() const;
void slideY2() const;
void swapTiles();
void cleanupTestCase();
private:
KShisen::TilePos m_tile1;
KShisen::TilePos m_tile2;
KShisen::TilePos m_tile1{1, 2};
KShisen::TilePos m_tile2{3, 4};
KShisen::Move m_moveWithoutSlide{m_tile1, m_tile2, 12, 34};
KShisen::Move m_moveWithSlide{m_tile1, m_tile2, 12, 34, 5, 6, 7, 8};
};
#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