X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestVR.cxx;h=303ec22dfaa1f422bc38d3e20df6cd44c982ffef;hb=42741e5f9bddec6ff604bffe74977848db3edf0a;hp=6370ad926fb3b312ca6d53d26561c0223178ae2d;hpb=9649936f884197f6f6260aae051d33729bce07d5;p=gdcm.git diff --git a/Testing/TestVR.cxx b/Testing/TestVR.cxx index 6370ad92..303ec22d 100644 --- a/Testing/TestVR.cxx +++ b/Testing/TestVR.cxx @@ -1,12 +1,101 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestVR.cxx,v $ + Language: C++ + Date: $Date: 2005/10/21 08:28:02 $ + Version: $Revision: 1.10 $ + + Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de + l'Image). All rights reserved. See Doc/License.txt or + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ #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 = new gdcm::VR(); + + 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++; + } + + delete vr; + return error; }