MCPcopy Create free account
hub / github.com/MITK/MITK / mitkDataStorageTest

Function mitkDataStorageTest

Modules/Core/test/mitkDataStorageTest.cpp:110–152  ·  view source on GitHub ↗

# Documentation # main testing method # NOTE: the current Singleton implementation of DataTreeStorage will lead to crashes if a testcase fails # and therefore mitk::DataStorage::ShutdownSingleton() is not called.

Source from the content-addressed store, hash-verified

108//## NOTE: the current Singleton implementation of DataTreeStorage will lead to crashes if a testcase fails
109//## and therefore mitk::DataStorage::ShutdownSingleton() is not called.
110int mitkDataStorageTest(int argc, char *argv[])
111{
112 MITK_TEST_BEGIN("DataStorageTest");
113
114 // muellerm: test observer tag remove
115 mitk::TestStandaloneDataStorage::Pointer testDS = mitk::TestStandaloneDataStorage::New();
116 mitk::DataNode::Pointer n1 = mitk::DataNode::New();
117 testDS->Add(n1);
118 MITK_TEST_CONDITION_REQUIRED(testDS->GetModifiedObserverTags().size() == 1,
119 "Testing if modified"
120 " observer was added.");
121 MITK_TEST_CONDITION_REQUIRED(testDS->GetDeletedObserverTags().size() == 1,
122 "Testing if delete"
123 " observer was added.");
124 testDS->Remove(n1);
125 MITK_TEST_CONDITION_REQUIRED(testDS->GetModifiedObserverTags().size() == 0,
126 "Testing if modified"
127 " observer was removed.");
128 MITK_TEST_CONDITION_REQUIRED(testDS->GetDeletedObserverTags().size() == 0,
129 "Testing if delete"
130 " observer was removed.");
131
132 /* Create StandaloneDataStorage */
133 MITK_TEST_OUTPUT(<< "Create StandaloneDataStorage : ");
134 mitk::StandaloneDataStorage::Pointer sds;
135 try
136 {
137 sds = mitk::StandaloneDataStorage::New();
138 MITK_TEST_CONDITION_REQUIRED(sds.IsNotNull(), "Testing Instantiation");
139 }
140 catch (...)
141 {
142 MITK_TEST_FAILED_MSG(<< "Exception during creation of StandaloneDataStorage");
143 }
144
145 MITK_TEST_OUTPUT(<< "Testing StandaloneDataStorage: ");
146 MITK_TEST_CONDITION_REQUIRED(argc > 1, "Testing correct test invocation");
147 TestDataStorage(sds, argv[1]);
148 // TODO: Add specific StandaloneDataStorage Tests here
149 sds = nullptr;
150
151 MITK_TEST_END();
152}
153
154//##Documentation
155//## @brief Test for the DataStorage class and its associated classes (e.g. the predicate classes)

Callers

nothing calls this directly

Calls 8

TestDataStorageFunction · 0.85
IsNotNullMethod · 0.80
NewFunction · 0.50
AddMethod · 0.45
sizeMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected