diff --git a/Core/Code/Testing/mitkLineTest.cpp b/Core/Code/Testing/mitkLineTest.cpp index 0dec0a320c..0ad03741a2 100644 --- a/Core/Code/Testing/mitkLineTest.cpp +++ b/Core/Code/Testing/mitkLineTest.cpp @@ -1,57 +1,83 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkTestingMacros.h" #include #include #include class mitkLineTestSuite : public mitk::TestFixture { CPPUNIT_TEST_SUITE(mitkLineTestSuite); - MITK_TEST(TestTempMethods); + MITK_TEST(Test2DLine); + MITK_TEST(Test3DLine); CPPUNIT_TEST_SUITE_END(); private: - mitk::Line m_Line; + mitk::Line m_2DLine; + mitk::Line m_3DLine; public: void setUp() { - m_Line = mitk::Line(); + //set up simple 2D Line + m_2DLine = mitk::Line(); itk::Point p; p[0] = 1; p[1] = 2; - m_Line.SetPoint(p); + m_2DLine.SetPoint(p); itk::Vector direction; direction[0] = 0; direction[1] = 1; - m_Line.SetDirection(direction); + m_2DLine.SetDirection(direction); + + //set up simple 3D Line + m_3DLine = mitk::Line(); + mitk::Point3D p3D; + mitk::FillVector3D(p3D,0,1,2); + m_3DLine.SetPoint(p3D); + + mitk::Vector3D direction3D; + mitk::FillVector3D(direction3D,4,5,6); + m_3DLine.SetDirection(direction3D); + } + + void Test2DLine() + { + CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (point[0])",m_2DLine.GetPoint()[0]==1); + CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (point[1])",m_2DLine.GetPoint()[1]==2); + CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (direction[0])",m_2DLine.GetDirection()[0]==0); + CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (direction[1])",m_2DLine.GetDirection()[1]==1); } - void TestTempMethods() + void Test3DLine() { - CPPUNIT_ASSERT(m_Line.GetPoint()[0]==1); + CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (point[0])",m_3DLine.GetPoint()[0]==0); + CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (point[1])",m_3DLine.GetPoint()[1]==1); + CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (point[2])",m_3DLine.GetPoint()[2]==2); + CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (direction[0])",m_3DLine.GetDirection()[0]==4); + CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (direction[1])",m_3DLine.GetDirection()[1]==5); + CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (direction[2])",m_3DLine.GetDirection()[2]==6); } }; MITK_TEST_SUITE_REGISTRATION(mitkLine)