26 std::string testValue1AsString,
27 std::string testValue2AsString,
30 std::cout <<
"Testing mitk::GenericProperty<" << type <<
">(" << testValue1AsString <<
", " << testValue2AsString
33 typename T::Pointer prop(T::New());
34 typename T::Pointer prop2(T::New(testValue1));
35 typename T::Pointer prop3(T::New(testValue2));
37 unsigned long tBefore = prop->GetMTime();
38 prop->SetValue(testValue1);
39 unsigned long tAfter = prop->GetMTime();
40 prop->SetValue(testValue1);
41 unsigned long tAfterAll = prop->GetMTime();
48 prop->SetValue(testValue2);
49 unsigned long tAfterEverything = prop->GetMTime();
51 std::cout <<
" Testing MTime correctness when changing property value: ";
52 if (tBefore >= tAfter || tAfterAll != tAfter || tAfterEverything <= tAfterAll)
54 std::cout <<
"[FAILED]" << std::endl;
57 std::cout <<
"[PASSED]" << std::endl;
59 prop->SetValue(testValue1);
60 std::cout <<
" Testing Assignment: ";
61 prop->AssignProperty(*prop3);
62 if ((!(*prop == *prop3)) || (*prop == *prop2))
64 std::cout <<
" [FAILED]" << std::endl;
67 std::cout <<
"[PASSED]" << std::endl;
68 std::cout << std::endl;
78 TestGenericPropertyForDataType<mitk::IntProperty>(1, 2,
"1",
"2",
"int");
79 TestGenericPropertyForDataType<mitk::BoolProperty>(
true,
false,
"1",
"0",
"bool");
80 TestGenericPropertyForDataType<mitk::FloatProperty>(1.0, -1.0,
"1",
"-1",
"float");
81 TestGenericPropertyForDataType<mitk::DoubleProperty>(1.0, -1.0,
"1",
"-1",
"double");
82 TestGenericPropertyForDataType<mitk::UIntProperty>(1, 100000,
"1",
"100000",
"unsigned int");
83 TestGenericPropertyForDataType<mitk::UShortProperty>(1, 20000,
"1",
"20000",
"unsigned short");
85 TestGenericPropertyForDataType<mitk::StringProperty>(
86 std::string(
"eins"), std::string(
"zwei"), std::string(
"eins"), std::string(
"zwei"),
"std::string");
97 TestGenericPropertyForDataType<mitk::Point3dProperty>(p1, p2,
"[2, 3, 4]",
"[-1, 2, 3]",
"mitk::Point3D");
111 TestGenericPropertyForDataType<mitk::Point4dProperty>(p1, p2,
"[2, 3, 4, -2]",
"[-1, 2, 3, 5]",
"mitk::Point4D");
131 TestGenericPropertyForDataType<mitk::Vector3DProperty>(p1, p2,
"[2, 3, 4]",
"[-1, 2, 3]",
"mitk::Vector3D");
int TestGenericPropertyForDataType(typename T::ValueType testValue1, typename T::ValueType testValue2, std::string testValue1AsString, std::string testValue2AsString, std::string type)
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
ValueType
Type of the value held by a Value object.
int mitkGenericPropertyTest(int, char *[])