Commit 10a051e7 authored by naucoin's avatar naucoin
Browse files

BUG: testing uncovered some null pointers not being checked for

git-svn-id: http://svn.slicer.org/Slicer4/trunk@13363 3bd1e089-480b-0410-8dfb-8563597acbee
parent bc7fb78e
......@@ -23,66 +23,7 @@ int vtkMRMLColorTableStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLColorTableStorageNode > node2 = vtkSmartPointer< vtkMRMLColorTableStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLColorTableStorageNode, node1);
return EXIT_SUCCESS;
}
......@@ -22,67 +22,7 @@ int vtkMRMLFiberBundleStorageNodeTest1(int , char * [] )
vtkSmartPointer< vtkMRMLFiberBundleStorageNode > node1 = vtkSmartPointer< vtkMRMLFiberBundleStorageNode >::New();
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLFiberBundleStorageNode > node2 = vtkSmartPointer< vtkMRMLFiberBundleStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLFiberBundleStorageNode, node1);
return EXIT_SUCCESS;
}
......@@ -23,66 +23,7 @@ int vtkMRMLFiducialListStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLFiducialListStorageNode > node2 = vtkSmartPointer< vtkMRMLFiducialListStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLFiducialListStorageNode, node1);
return EXIT_SUCCESS;
}
......@@ -23,66 +23,7 @@ int vtkMRMLFreeSurferModelOverlayStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLFreeSurferModelOverlayStorageNode > node2 = vtkSmartPointer< vtkMRMLFreeSurferModelOverlayStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLFreeSurferModelOverlayStorageNode, node1);
return EXIT_SUCCESS;
}
......@@ -22,7 +22,7 @@ int vtkMRMLFreeSurferModelStorageNodeTest1(int , char * [] )
vtkSmartPointer< vtkMRMLFreeSurferModelStorageNode > node1 = vtkSmartPointer< vtkMRMLFreeSurferModelStorageNode >::New();
EXERCISE_BASIC_OBJECT_METHODS( node1 );
// EXERCISE_BASIC_MRML_METHODS(vtkMRMLFreeSurferModelStorageNode, node1);
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLFreeSurferModelStorageNode, node1);
return EXIT_SUCCESS;
......
......@@ -23,5 +23,7 @@ int vtkMRMLModelStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLModelStorageNode, node1);
return EXIT_SUCCESS;
}
......@@ -23,66 +23,7 @@ int vtkMRMLNRRDStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLNRRDStorageNode > node2 = vtkSmartPointer< vtkMRMLNRRDStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLNRRDStorageNode, node1);
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -47,7 +47,7 @@ int vtkMRMLStorageNodeTest1(int , char * [] )
vtkSmartPointer< vtkMRMLStorageNodeTestHelper1 > node1 = vtkSmartPointer< vtkMRMLStorageNodeTestHelper1 >::New();
EXERCISE_BASIC_OBJECT_METHODS( node1 );
vtkMRMLNode * newNode = node1->CreateNodeInstance();
if( newNode == NULL )
......
......@@ -22,67 +22,8 @@ int vtkMRMLTransformStorageNodeTest1(int , char * [] )
vtkSmartPointer< vtkMRMLTransformStorageNode > node1 = vtkSmartPointer< vtkMRMLTransformStorageNode >::New();
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLTransformStorageNode > node2 = vtkSmartPointer< vtkMRMLTransformStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLTransformStorageNode, node1);
return EXIT_SUCCESS;
}
......@@ -23,66 +23,7 @@ int vtkMRMLUnstructuredGridStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLUnstructuredGridStorageNode > node2 = vtkSmartPointer< vtkMRMLUnstructuredGridStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLUnstructuredGridStorageNode, node1);
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -23,66 +23,7 @@ int vtkMRMLVolumeArchetypeStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLVolumeArchetypeStorageNode > node2 = vtkSmartPointer< vtkMRMLVolumeArchetypeStorageNode >::New();
node2->Copy( node1 );
node2->Reset();
node2->StartModify();
std::string nodeTagName = node1->GetNodeTagName();
std::cout << "Node Tag Name = " << nodeTagName << std::endl;
std::string attributeName;
std::string attributeValue;
node1->SetAttribute( attributeName.c_str(), attributeValue.c_str() );
std::string attributeValue2 = node1->GetAttribute( attributeName.c_str() );
if( attributeValue != attributeValue2 )
{
std::cerr << "Error in Set/GetAttribute() " << std::endl;
return EXIT_FAILURE;
}
TEST_SET_GET_BOOLEAN( node1, HideFromEditors );
TEST_SET_GET_BOOLEAN( node1, Selectable );
TEST_SET_GET_STRING( node1, Description );
TEST_SET_GET_STRING( node1, SceneRootDir );
TEST_SET_GET_STRING( node1, Name );
TEST_SET_GET_STRING( node1, SingletonTag );
TEST_SET_GET_BOOLEAN( node1, ModifiedSinceRead );
TEST_SET_GET_BOOLEAN( node1, SaveWithScene );
TEST_SET_GET_BOOLEAN( node1, AddToScene );
TEST_SET_GET_BOOLEAN( node1, Selected );
node1->Modified();
vtkMRMLScene * scene = node1->GetScene();
if( scene != NULL )
{
std::cerr << "Error in GetScene() " << std::endl;
return EXIT_FAILURE;
}
std::string stringToEncode = "Thou Shall Test !";
std::string stringURLEncoded = node1->URLEncodeString( stringToEncode.c_str() );
std::string stringDecoded = node1->URLDecodeString( stringURLEncoded.c_str() );
if( stringDecoded != stringToEncode )
{
std::cerr << "Error in URLEncodeString/URLDecodeString() " << std::endl;
return EXIT_FAILURE;
}
EXERCISE_BASIC_STORAGE_MRML_METHODS(vtkMRMLVolumeArchetypeStorageNode, node1);
return EXIT_SUCCESS;
}
......@@ -23,66 +23,7 @@ int vtkMRMLVolumeHeaderlessStorageNodeTest1(int , char * [] )
EXERCISE_BASIC_OBJECT_METHODS( node1 );
node1->UpdateReferences();
vtkSmartPointer< vtkMRMLVolumeHeaderlessStorageNode > node2 = vtkSmartPointer< vtkMRMLVolumeHeaderlessStorageNode >::New();