X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestVR.cxx;h=26e8144f0cff02c8c4a15fbb54b88b501761d242;hb=c556c62e38ad8f5b0423a91d919c13ac85a23f32;hp=8fa9348d4696ec3c3b6940f78052bbfd60897cc1;hpb=5ce83ba7ad93f458923e5f3b7aa406651db90637;p=gdcm.git diff --git a/Testing/TestVR.cxx b/Testing/TestVR.cxx index 8fa9348d..26e8144f 100644 --- a/Testing/TestVR.cxx +++ b/Testing/TestVR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestVR.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 04:28:20 $ - Version: $Revision: 1.2 $ + Date: $Date: 2005/10/25 14:52:31 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,14 +16,86 @@ =========================================================================*/ #include "gdcmVR.h" +#include "gdcmDebug.h" int TestVR(int , char *[]) { - gdcm::VR vr; - // There should be 16 entries - vr.Print( std::cout ); - vr.IsVROfGdcmStringRepresentable( "" ); - vr.IsVROfGdcmBinaryRepresentable( "" ); + int error = 0; + gdcm::VR *vr = gdcm::VR::New(); + + gdcm::Debug::DebugOn(); - return 0; + // There should be 16 entries ... + vr->Print( std::cout ); + + // Valid VR + if( !vr->IsValidVR( "PN" ) ) + { + std::cerr << "'PN' is not a valid VR" << std::endl; + error++; + } + if( !vr->IsValidVR( "FD" ) ) + { + std::cerr << "'FD' is not a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( "" ) ) + { + std::cerr << "'' is a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( " " ) ) + { + std::cerr << "' ' is a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( "\000/" ) ) + { + std::cerr << "' /' is a valid VR" << std::endl; + error++; + } + if( vr->IsValidVR( gdcm::GDCM_VRUNKNOWN ) ) + { + std::cerr << "' ' is a valid VR" << std::endl; + error++; + } + + // String representable + if( !vr->IsVROfStringRepresentable( "PN" ) ) + { + std::cerr << "'PN' is not a string representable" << std::endl; + error++; + } + if( vr->IsVROfStringRepresentable( "FD" ) ) + { + std::cerr << "'FD' is a string representable" << std::endl; + error++; + } + + // Binary representable + if( !vr->IsVROfBinaryRepresentable( "FD" ) ) + { + std::cerr << "FD is not a binary representable" << std::endl; + error++; + } + if( vr->IsVROfBinaryRepresentable( "PN" ) ) + { + std::cerr << "'PN' is a binary representable" << std::endl; + error++; + } + + // Sequence + if( vr->IsVROfSequence( "" ) ) + { + std::cerr << "'' is a sequence" << std::endl; + error++; + } + if( !vr->IsVROfSequence( "SQ" ) ) + { + std::cerr << "'SQ' is not a sequence" << std::endl; + error++; + } + + vr->Delete(); + return error; }