Program: gdcm
Module: $RCSfile: TestDataEntry.cxx,v $
Language: C++
- Date: $Date: 2005/10/23 19:52:37 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2005/10/24 16:00:46 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
const double dvalue[]={1.1,2.2,3.3,4.4,5.5};
const unsigned long nbvalue = 5;
-const float GDCM_EPS = 1e-6;
+const double GDCM_EPS = 1e-6;
/**
* \brief Test the DataEntry object
//------------------------------------------------------------------
dict = gdcm::DictEntry::New(0x0000,0x0000);
- entry = new gdcm::DataEntry(dict);
+ entry = gdcm::DataEntry::New(dict);
dict->SetVR("US");
std::cout << "Test for VR = " << dict->GetVR() << "..." << std::endl;
<< " Found: " << entry->GetValueCount()
<< " - Must be: 1" << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
<< " Found: " << entry->GetValueCount()
<< " - Must be: 2" << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
<< " Found: " << entry->GetValueCount()
<< " - Must be: 0" << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
std::cout << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
//------------------------------------------------------------------
dict = gdcm::DictEntry::New(0x0000,0x0000);
- entry = new gdcm::DataEntry(dict);
+ entry = gdcm::DataEntry::New(dict);
dict->SetVR("LT");
std::cout << "Test for VR = " << dict->GetVR() << "..." << std::endl;
<< " Found: " << entry->GetLength()
<< " - Must be: " << strlen(data) + strlen(data)%2 << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( memcmp(entry->GetBinArea(),data,entry->GetLength()) != 0 )
std::cout << " Failed" << std::endl
<< " Content of bin area is incorrect" << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( memcmp(entry->GetString().c_str(),data,entry->GetLength()) != 0 )
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << data << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found " << entry->GetValue(i)
<< " - Must be " << svalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
std::cout << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
//------------------------------------------------------------------
dict = gdcm::DictEntry::New(0x0000,0x0000);
- entry = new gdcm::DataEntry(dict);
+ entry = gdcm::DataEntry::New(dict);
dict->SetVR("US");
std::cout << "Test for VR = " << dict->GetVR() << "..." << std::endl;
<< " Found: " << entry->GetLength()
<< " - Must be: " << nbvalue*sizeof(uint16_t) << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( memcmp(entry->GetString().c_str(),data,strlen(data)) != 0 )
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << data << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << svalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << data << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << svalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
std::cout << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
//------------------------------------------------------------------
dict = gdcm::DictEntry::New(0x0000,0x0000);
- entry = new gdcm::DataEntry(dict);
+ entry = gdcm::DataEntry::New(dict);
dict->SetVR("UL");
std::cout << "Test for VR = " << dict->GetVR() << "..." << std::endl;
<< " Found: " << entry->GetLength()
<< " - Must be: " << nbvalue*sizeof(uint32_t) << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( memcmp(entry->GetString().c_str(),data,strlen(data)) != 0 )
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << data << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << lvalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << data << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << lvalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
std::cout << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
//------------------------------------------------------------------
dict = gdcm::DictEntry::New(0x0000,0x0000);
- entry = new gdcm::DataEntry(dict);
+ entry = gdcm::DataEntry::New(dict);
dict->SetVR("FL");
std::cout << "Test for VR = " << dict->GetVR() << "..." << std::endl;
<< " Found: " << entry->GetLength()
<< " - Must be: " << nbvalue*sizeof(float) << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( memcmp(entry->GetString().c_str(),fdata,strlen(fdata)) != 0 )
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << fdata << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << fvalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << fdata << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << fvalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
std::cout << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
//------------------------------------------------------------------
dict = gdcm::DictEntry::New(0x0000,0x0000);
- entry = new gdcm::DataEntry(dict);
+ entry = gdcm::DataEntry::New(dict);
dict->SetVR("FD");
std::cout << "Test for VR = " << dict->GetVR() << "..." << std::endl;
<< " Found: " << entry->GetLength()
<< " - Must be: " << nbvalue*sizeof(double) << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( memcmp(entry->GetString().c_str(),fdata,strlen(fdata)) != 0 )
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << fdata << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << dvalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
<< " Found: " << entry->GetString().c_str()
<< " - Must be: " << fdata << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
if( entry->GetValueCount() != nbvalue )
<< " Found: " << entry->GetValueCount()
<< " - Must be: " << nbvalue << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
for(i=0;i<entry->GetValueCount();i++)
<< " Found: " << entry->GetValue(i)
<< " - Must be: " << dvalue[i] << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
return 1;
}
}
std::cout << std::endl;
dict->Delete();
- delete entry;
+ entry->Delete();
//------------------------------------------------------------------
std::cout<<std::flush;