X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestAllVM.cxx;h=e0181e9cfb705ab29757085281ad7a9391bc9a9a;hb=be54306f862b4c88b06397e266070903556f44f2;hp=be2e7973fffc5cbbd4bd91b41a2af5f26b82342a;hpb=27e8696556eff77e15a7a8fc2976ed31f882e0f1;p=gdcm.git diff --git a/Testing/TestAllVM.cxx b/Testing/TestAllVM.cxx index be2e7973..e0181e9c 100644 --- a/Testing/TestAllVM.cxx +++ b/Testing/TestAllVM.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAllVM.cxx,v $ Language: C++ - Date: $Date: 2005/10/21 14:51:36 $ - Version: $Revision: 1.2 $ + Date: $Date: 2005/10/21 16:32:10 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,29 +22,31 @@ //Generated file: #include "gdcmDataImages.h" -int TestAllVM(int, char *[]) +int DoTheVMTest(std::string const &filename) { - int i = 0; - - while( gdcmDataImages[i] != 0 ) - { - std::string filename = GDCM_DATA_ROOT; - filename += "/"; - filename += gdcmDataImages[i]; - gdcm::File file; - file.SetLoadMode( gdcm::LD_ALL ); + // - Do not test unknow VM in shadow groups (in element 0x0000 is present + // - Skip Sequences (if they are 'True Length'); loading will be quicker + // (anyway, Sequences are skipped at processing time ...) + file.SetLoadMode( gdcm::LD_NOSHADOW | gdcm::LD_NOSEQ ); + file.SetFileName( filename ); if( !file.Load() ) //would be really bad... return 1; gdcm::DocEntry *d = file.GetFirstEntry(); + std::cerr << "Testing file : " << filename << std::endl; while(d) { if ( gdcm::DataEntry *de = dynamic_cast(d) ) { - if(! de->IsValueCountValid() ) - std::cerr << "Filename:" << filename << std::endl; + if( !de->IsValueCountValid() ) + { + std::cerr << "Element: " << de->GetKey() << + " (" << de->GetName() << ") " << + "Contains a wrong VM: " << de->GetValueCount() + << " should be: " << de->GetVM() << std::endl;; + } } else { @@ -54,8 +56,33 @@ int TestAllVM(int, char *[]) d = file.GetNextEntry(); } + return 0; +} + +int TestAllVM(int argc, char *argv[]) +{ + int i = 0; + if( argc >= 2 ) + { + const char *filename = argv[1]; + if( DoTheVMTest( filename ) ) + return 1; + return 0; + } + // else + + while( gdcmDataImages[i] != 0 ) + { + std::string filename = GDCM_DATA_ROOT; + filename += "/"; + filename += gdcmDataImages[i]; + + if( DoTheVMTest( filename ) ) + return 1; i++; + std::cerr << std::endl; // skip a line after each file } + return 0; }