X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestVR.cxx;h=46ab1af17d68b19a2c54ba003ed0cbfc988f49da;hb=bd7bec4c367d671a9da358584e98a8ec29bb641e;hp=1b7b047213c72da258aaca92401333e5b23c4247;hpb=bf15a99667fae49047bb72ba0bfda6e129bb045e;p=gdcm.git diff --git a/Testing/TestVR.cxx b/Testing/TestVR.cxx index 1b7b0472..46ab1af1 100644 --- a/Testing/TestVR.cxx +++ b/Testing/TestVR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestVR.cxx,v $ Language: C++ - Date: $Date: 2005/01/27 10:43:19 $ - Version: $Revision: 1.5 $ + Date: $Date: 2007/05/23 14:18:06 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,31 +16,89 @@ =========================================================================*/ #include "gdcmVR.h" +#include "gdcmDebug.h" int TestVR(int , char *[]) { - gdcm::VR *tempVrDict=0; - std::cout << "------ Test Default VR Dictionary : ----------" << std::endl; - // Just to improve test coverage: - // tempVrDict = new gdcm::Dict("dummyFileNameThatDoesntExist"); - // tempVrDict->Print(); - // std::cout << "----- end Test Default VR Dictionary : -----" << std::endl; - - // Lets delete it. - delete tempVrDict; - - gdcm::VR *vr = new gdcm::VR(); + int error = 0; + GDCM_NAME_SPACE::VR *vr = GDCM_NAME_SPACE::VR::New(); - // There should be 16 entries + GDCM_NAME_SPACE::Debug::DebugOn(); + + // We should test the 27 entries ... vr->Print( std::cout ); - vr->IsVROfStringRepresentable( "PN" ); - vr->IsVROfStringRepresentable( "FD" ); + // Valid VR + if( !vr->IsValidVR( "PN" ) ) + { + std::cerr << "'PN' is not recognized as a valid VR" << std::endl; + error++; + } + if( !vr->IsValidVR( "FD" ) ) + { + std::cerr << "'FD' is not recognized as a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( "" ) ) + { + std::cerr << "'' is recognized as a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( " " ) ) + { + std::cerr << "' ' is recognized as a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( "\000/" ) ) + { + std::cerr << "' /' is recognized as a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( GDCM_NAME_SPACE::GDCM_VRUNKNOWN ) ) + { + std::cerr << "' ' is recognized as a valid VR" << std::endl; + error++; + } + + // String representable + //--------------------- + if( !vr->IsVROfStringRepresentable( "PN" ) ) + { + std::cerr << "'PN' is not recognized as a string representable" << std::endl; + error++; + } + if( vr->IsVROfStringRepresentable( "OB" ) ) + { + std::cerr << "'OB' is recognized as a string representable" << std::endl; + error++; + } - vr->IsVROfBinaryRepresentable( "FD" ); - vr->IsVROfBinaryRepresentable( "PN" ); + // Binary representable + //--------------------- + if( !vr->IsVROfBinaryRepresentable( "OB" ) ) + { + std::cerr << "OB is not recognized as a binary representable" << std::endl; + error++; + } + if( vr->IsVROfBinaryRepresentable( "PN" ) ) + { + std::cerr << "'PN' is a binary representable" << std::endl; + error++; + } - vr->IsVROfSequence( "" ); + // Sequence + //--------- + if( vr->IsVROfSequence( "" ) ) + { + std::cerr << "'' is a sequence" << std::endl; + error++; + } + if( !vr->IsVROfSequence( "SQ" ) ) + { + std::cerr << "'SQ' is not recognized as a Sequence" << std::endl; + error++; + } - return 0; + vr->Delete(); + return error; }