X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestAllEntryVerify.cxx;h=0490f35291a66e7a0d57a4e60733ad00efa30d35;hb=610786e334321c5c9a69139e1054372c76ed78d4;hp=6daec820304308f7a2599d8a1d6df168ebcd91ce;hpb=1d69b92978803204089d270599133917d944c651;p=gdcm.git diff --git a/Testing/TestAllEntryVerify.cxx b/Testing/TestAllEntryVerify.cxx index 6daec820..0490f352 100644 --- a/Testing/TestAllEntryVerify.cxx +++ b/Testing/TestAllEntryVerify.cxx @@ -1,3 +1,20 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestAllEntryVerify.cxx,v $ + Language: C++ + Date: $Date: 2004/11/16 04:28:20 $ + Version: $Revision: 1.14 $ + + Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de + l'Image). All rights reserved. See Doc/License.txt or + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ #include "gdcmHeader.h" #include @@ -9,7 +26,7 @@ #include "gdcmDataImages.h" typedef std::string EntryValueType; // same type as ValEntry::value -typedef std::map< TagKey, EntryValueType > MapEntryValues; +typedef std::map< gdcm::TagKey, EntryValueType > MapEntryValues; typedef MapEntryValues* MapEntryValuesPtr; typedef std::string FileNameType; typedef std::map< FileNameType, MapEntryValuesPtr > MapFileValuesType; @@ -194,11 +211,19 @@ bool ReferenceFileParser::Check() std::string testedValue = tested->GetEntryByNumber(group, element); if ( testedValue != j->second ) { - std::cout << Indent << "Uncorrect value for key " << key << std::endl - << Indent << " read value [" << testedValue << "]" << std::endl - << Indent << " reference value [" << j->second << "]" - << std::endl; + // Oops make sure this is only the \0 that differ + if( testedValue[j->second.size()] != '\0' || + strncmp(testedValue.c_str(), + j->second.c_str(), j->second.size()) != 0) + { + std::cout << Indent << "Uncorrect value for key " + << key << std::endl + << Indent << " read value [" + << testedValue << "]" << std::endl + << Indent << " reference value [" + << j->second << "]" << std::endl; return false; + } } } delete tested; @@ -306,7 +331,7 @@ void ReferenceFileParser::FirstPassReferenceFile() throw ( ParserException ) while ( ! from.eof() ) { - getline( from, line ); + std::getline( from, line ); /// This is how we usually end the parsing because we hit EOF: if ( ! from.good() ) @@ -533,7 +558,7 @@ void ReferenceFileParser::ParseRegularLine( std::string& line) bool ReferenceFileParser::SecondPassReferenceFile() throw ( ParserException ) { - TagKey key; + gdcm::TagKey key; EntryValueType value; std::string line; bool inBlock = false; @@ -541,7 +566,7 @@ bool ReferenceFileParser::SecondPassReferenceFile() while ( !from.eof() ) { - getline( from, line ); + std::getline( from, line ); lineNumber++; CleanUpLine( line );