From: Daniel Karbach Date: Thu, 7 Jan 2016 09:52:30 +0000 (+0100) Subject: added block orientation test X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=ec85ac414e4e60295484ca1752876919ce5a8390;p=blank.git added block orientation test --- diff --git a/tst/world/BlockTest.cpp b/tst/world/BlockTest.cpp index 85b5a68..b1c2ad2 100644 --- a/tst/world/BlockTest.cpp +++ b/tst/world/BlockTest.cpp @@ -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", diff --git a/tst/world/BlockTest.hpp b/tst/world/BlockTest.hpp index 467d260..1102ba0 100644 --- a/tst/world/BlockTest.hpp +++ b/tst/world/BlockTest.hpp @@ -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();