X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=Testing%2FTestValidate.cxx;h=01c300ba76dec37aceaad8c0417348a5e038ba7f;hb=db42e5541964319d882c965dc6d0284806ff0489;hp=6162fcf6342a9b320099670bcf558ce817d5594b;hpb=8ea92706ea6ef5e97c3cdca1daa41c9a3063bd7a;p=gdcm.git diff --git a/Testing/TestValidate.cxx b/Testing/TestValidate.cxx index 6162fcf6..01c300ba 100644 --- a/Testing/TestValidate.cxx +++ b/Testing/TestValidate.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestValidate.cxx,v $ Language: C++ - Date: $Date: 2005/06/14 20:33:53 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/11/09 08:32:50 $ + 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 @@ -18,21 +18,61 @@ #include "gdcmFile.h" #include "gdcmValidator.h" +#include "gdcmGlobal.h" +#include "gdcmDictSet.h" -int TestValidate(int argc, char *argv[]) -{ - if( argc < 2 ) - { - std::cerr << "ouh les cornes" << std::endl; - return 1; - } +//Generated file: +#include "gdcmDataImages.h" - const char *filename = argv[1]; +int Validate(std::string const &filename); - gdcm::File *input = new gdcm::File( filename ); +int Validate(std::string const &filename) +{ + gdcm::File *input = gdcm::File::New( ); + input->SetFileName(filename); + input->Load(); gdcm::Validator *v = new gdcm::Validator(); v->SetInput( input ); + return 1; // allways true (we don't want to break the test suite) +} + + +int TestValidate(int argc, char *argv[]) +{ + if ( argc == 2 ) + { + // The test is specified a specific filename, use it instead of looping + // over all images + const std::string input = argv[1]; + return Validate( input ); + } + else if ( argc > 2 || argc == 2 ) + { + std::cout << " Usage: " << argv[0] + << " (no arguments needed)." << std::endl; + std::cout << "or Usage: " << argv[0] + << " filename.dcm " << std::endl; + return 1; + } + // Try to track the "FIXME" problem for VM + gdcm::Global::GetDicts()->GetDefaultPubDict()->Print(); + + int i =0; + int retVal = 0; //by default this is an error + while( gdcmDataImages[i] != 0 ) + { + std::string filename = GDCM_DATA_ROOT; + filename += "/"; //doh! + filename += gdcmDataImages[i]; + std::cout << filename << std::endl; + if( Validate( filename ) != 0 ) + { + retVal++; + } - return 0; + i++; + } + retVal = 0; // Never break test suite + return retVal; }