]> git.localhorst.tv Git - blank.git/commitdiff
added block orientation test
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 7 Jan 2016 09:52:30 +0000 (10:52 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 7 Jan 2016 09:52:30 +0000 (10:52 +0100)
tst/world/BlockTest.cpp
tst/world/BlockTest.hpp

index 85b5a68b33a0ec04cd85c1429db1cfc2667fd347..b1c2ad2b1cbbecd2c3b710d886645f2a4b3a4c93 100644 (file)
@@ -17,6 +17,38 @@ void BlockTest::tearDown() {
 }
 
 
+void BlockTest::testOrientation() {
+       Block block(0, Block::FACE_DOWN, Block::TURN_LEFT);
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(
+               "wrong block face after initialization",
+               block.GetFace(), Block::FACE_DOWN
+       );
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(
+               "wrong block turn after initialization",
+               block.GetTurn(), Block::TURN_LEFT
+       );
+
+       block.SetFace(Block::FACE_BACK);
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(
+               "changing block face has unexpected effect",
+               block.GetFace(), Block::FACE_BACK
+       );
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(
+               "changing block face affected turn",
+               block.GetTurn(), Block::TURN_LEFT
+       );
+
+       block.SetTurn(Block::TURN_AROUND);
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(
+               "changing block turn has unexpected effect",
+               block.GetTurn(), Block::TURN_AROUND
+       );
+       CPPUNIT_ASSERT_EQUAL_MESSAGE(
+               "changing block turn affected face",
+               block.GetFace(), Block::FACE_BACK
+       );
+}
+
 void BlockTest::testFaceOpposite() {
        CPPUNIT_ASSERT_EQUAL_MESSAGE(
                "DOWN not opposite of UP",
index 467d2600e9540cf537a1dc3709a0104ddd8d719c..1102ba0f03e25fd0a46001d7872f8a5eae094054 100644 (file)
@@ -12,6 +12,7 @@ class BlockTest
 
 CPPUNIT_TEST_SUITE(BlockTest);
 
+CPPUNIT_TEST(testOrientation);
 CPPUNIT_TEST(testFaceOpposite);
 CPPUNIT_TEST(testFaceAxis);
 CPPUNIT_TEST(testFaceNormal);
@@ -27,6 +28,8 @@ public:
        void setUp();
        void tearDown();
 
+       void testOrientation();
+
        void testFaceOpposite();
        void testFaceAxis();
        void testFaceNormal();