]> Creatis software - gdcm.git/blobdiff - Testing/TestAllEntryVerify.cxx
ENH: Improve string manipulation. I now inforce the notion of 'DicomString'
[gdcm.git] / Testing / TestAllEntryVerify.cxx
index 995dcf26ac838a5a76fc2bbca008d716c200476d..a2dc4abc00c9b72a1150623a3b8805a3d5effd5a 100644 (file)
@@ -194,11 +194,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;