From 9e3f678ba17cc24e8ee3972a6367b53bcd4d23d4 Mon Sep 17 00:00:00 2001 From: malaterre Date: Fri, 21 Oct 2005 15:16:22 +0000 Subject: [PATCH] ENH: Rearchitecture the test to test one file at a time --- Testing/TestAllVM.cxx | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/Testing/TestAllVM.cxx b/Testing/TestAllVM.cxx index 3b108d14..425567e2 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 15:02:31 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/10/21 15:16:22 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,18 +22,11 @@ //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_NOSHADOW ); + // Do not test unknow VM ... + file.SetLoadMode( gdcm::LD_NOSHADOW | gdcm::LD_NOSHADOWSEQ ); file.SetFileName( filename ); if( !file.Load() ) //would be really bad... return 1; @@ -60,9 +53,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; } -- 2.48.1