27 template <
typename DATA>
28 struct assertion_traits<
std::vector<DATA>>
30 static bool equal(
const std::vector<DATA> &x,
const std::vector<DATA> &y) {
return x == y; }
31 static std::string toString(
const std::vector<DATA> &values)
35 ost <<
"'" << v <<
"' ";
43 template <
typename DATA>
44 struct assertion_traits<
mitk::VectorProperty<DATA>>
61 CPPUNIT_TEST_SUITE(mitkVectorPropertyTestSuite);
66 CPPUNIT_TEST_SUITE_END();
78 void tearDown()
override
80 m_DoubleData =
nullptr;
87 std::vector<T> MakeSimpleList()
102 std::vector<T> data = MakeSimpleList<T>();
105 std::vector<T> stored = prop.
GetValue();
107 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Result of GetValue() should equal parameter of SetValue(data)", data, stored);
112 TestSetGet(*m_DoubleData);
113 TestSetGet(*m_IntData);
117 template <
typename T>
120 std::vector<T> data = MakeSimpleList<T>();
123 std::vector<T> modifiedData(data);
124 modifiedData.back() = -modifiedData.back();
126 modifiedProperty->SetValue(modifiedData);
128 CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE(
"Modified list shall be recognized by IsEqual()",
129 CPPUNIT_ASSERT_EQUAL(*modifiedProperty, prop));
131 modifiedData.pop_back();
132 modifiedProperty->SetValue(modifiedData);
133 CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE(
"Removed element shall be recognized by IsEqual()",
134 CPPUNIT_ASSERT_EQUAL(*modifiedProperty, prop));
139 TestIsEqual(*m_DoubleData);
140 TestIsEqual(*m_IntData);
144 template <
typename T>
147 std::vector<T> data = MakeSimpleList<T>();
151 CPPUNIT_ASSERT(clone.IsNotNull());
152 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Result of Clone() shall equal original property", *clone, prop);
154 std::vector<T> origData = prop.
GetValue();
155 std::vector<T> cloneData = clone->GetValue();
157 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Clone shall have a copy of original data", cloneData, origData);
162 TestClone(*m_DoubleData);
163 TestClone(*m_IntData);
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
virtual void SetValue(const VectorType ¶meter_vector)
sets the content vector
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
DataCollection - Class to facilitate loading/accessing structured data.
virtual std::string GetValueAsString() const override
static void clone(T *&dst, S *src, int n)
virtual const VectorType & GetValue() const
returns a const reference to the contained vector
Test fixture for parameterized tests.
Providing a std::vector as property.