Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "mitkOrganTypeProperty.h"
00019 #include "mitkCoreObjectFactory.h"
00020
00022 int mitkOrganTypePropertyTest(int , char* [])
00023 {
00024 const char* NEW_ORGAN = "Der Knopf von der Eingangstuer von der Siebenschlaeferbehausung ist aus Messing damit es nicht so schnell rostet";
00025
00026
00027 unsigned int numberFailed(0);
00028
00029 std::cout << "Instantiation" << std::endl;
00030
00031
00032 mitk::OrganTypeProperty::Pointer prop1 = mitk::OrganTypeProperty::New();
00033 if (prop1.IsNotNull())
00034 {
00035 std::cout << " (II) Instantiation works." << std::endl;
00036 }
00037 else
00038 {
00039 ++numberFailed;
00040 std::cout << numberFailed << " test failed, and it's the ugliest one!" << std::endl;
00041 return EXIT_FAILURE;
00042 }
00043
00044 mitk::OrganTypeProperty::Pointer prop2 = mitk::OrganTypeProperty::New();
00045 if (prop1.IsNotNull())
00046 {
00047 std::cout << " (II) Instantiation still works." << std::endl;
00048 }
00049 else
00050 {
00051 ++numberFailed;
00052 std::cout << numberFailed << " test failed, and it's the ugliest one!" << std::endl;
00053 return EXIT_FAILURE;
00054 }
00055
00056
00057 prop1->AddEnum( NEW_ORGAN, prop1->Size() );
00058
00059 if ( !prop1->IsValidEnumerationValue( NEW_ORGAN ) )
00060 {
00061 ++numberFailed;
00062 std::cout << " (EE) New organ is not a valid enumeration type after adding calling AddEnum()." << std::endl;
00063 }
00064 else
00065 {
00066 std::cout << " (II) AddEnum() works." << std::endl;
00067 }
00068
00069 if ( !prop2->IsValidEnumerationValue( NEW_ORGAN ) )
00070 {
00071 ++numberFailed;
00072 std::cout << " (EE) New organ type did not propagate to a second instance of OrganTypeProperty." << std::endl;
00073 }
00074
00075 std::cout << "Object destruction" << std::endl;
00076
00077
00078 prop1 = NULL;
00079 std::cout << " (II) Freeing works for first property." << std::endl;
00080 prop2 = NULL;
00081
00082 std::cout << " (II) Freeing works for both properties." << std::endl;
00083
00084 if (numberFailed > 0)
00085 {
00086 std::cout << numberFailed << " tests failed." << std::endl;
00087 return EXIT_FAILURE;
00088 }
00089 else
00090 {
00091 std::cout << "PASSED all tests." << std::endl;
00092 return EXIT_SUCCESS;
00093 }
00094 }
00095