diff --git a/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureReaderWriterTest.cpp b/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureReaderWriterTest.cpp index 782d7fa41d..0a44cc952f 100644 --- a/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureReaderWriterTest.cpp +++ b/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureReaderWriterTest.cpp @@ -1,74 +1,74 @@ /*=================================================================== 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. ===================================================================*/ // Testing #include "mitkTestingMacros.h" #include "mitkTestFixture.h" // std includes #include // MITK includes #include "mitkExampleDataStructure.h" #include "mitkIOUtil.h" // VTK includes #include class mitkExampleDataStructureReaderWriterTestSuite : public mitk::TestFixture { CPPUNIT_TEST_SUITE(mitkExampleDataStructureReaderWriterTestSuite); // Test saving/loading - MITK_TEST(ExampleDataInOutput); + MITK_TEST(ReadWrite_ExampleData_SavedAndLoadedDataEqualToExample); CPPUNIT_TEST_SUITE_END(); private: mitk::ExampleDataStructure::Pointer m_Data; std::string m_DefaultDataString; public: /** * @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called). */ void setUp() override { m_DefaultDataString = "This is the example data content\nAnd a second line\n"; m_Data = mitk::ExampleDataStructure::New(); m_Data->SetData(m_DefaultDataString); } void tearDown() override { m_DefaultDataString = ""; m_Data = nullptr; } - void ExampleDataInOutput() + void ReadWrite_ExampleData_SavedAndLoadedDataEqualToExample() { std::string path = mitk::IOUtil::GetTempPath() + "ExampleDataOutput.txt"; mitk::IOUtil::SaveBaseData(m_Data, path); mitk::ExampleDataStructure::Pointer loadedData = dynamic_cast(mitk::IOUtil::LoadBaseData(path).GetPointer()); itksys::SystemTools::RemoveFile(path); CPPUNIT_ASSERT_MESSAGE("Comparing created and loaded example data.", mitk::Equal(m_Data, loadedData, mitk::eps, true)); } }; MITK_TEST_SUITE_REGISTRATION(mitkExampleDataStructureReaderWriter) diff --git a/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureTest.cpp b/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureTest.cpp index dd18227ada..e94b0ce60b 100644 --- a/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureTest.cpp +++ b/Examples/FirstSteps/NewModule/test/mitkExampleDataStructureTest.cpp @@ -1,71 +1,71 @@ /*=================================================================== 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. ===================================================================*/ // Testing #include "mitkTestingMacros.h" #include "mitkTestFixture.h" // std includes #include // MITK includes #include "mitkExampleDataStructure.h" // VTK includes #include class mitkExampleDataStructureTestSuite : public mitk::TestFixture { CPPUNIT_TEST_SUITE(mitkExampleDataStructureTestSuite); // Test the append method - MITK_TEST(ExampleDataAppend); + MITK_TEST(Append_ExampleString_AddsExampleStringToData); CPPUNIT_TEST_SUITE_END(); private: mitk::ExampleDataStructure::Pointer m_Data; std::string m_DefaultDataString; public: /** * @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called). */ void setUp() override { m_DefaultDataString = "This is the example data content\nAnd a second line\n"; m_Data = mitk::ExampleDataStructure::New(); m_Data->SetData(m_DefaultDataString); } void tearDown() override { m_DefaultDataString = ""; m_Data = nullptr; } - void ExampleDataAppend() + void Append_ExampleString_AddsExampleStringToData() { std::string appendedString = "And a third line\n"; std::string wholeString = m_DefaultDataString + appendedString; m_Data->AppendAString(appendedString); CPPUNIT_ASSERT_MESSAGE("Checking whether string was correctly appended.", m_Data->GetData() == wholeString); } }; MITK_TEST_SUITE_REGISTRATION(mitkExampleDataStructure)