X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestVR.cxx;h=ab07e8940d07bb38314aa990e137a5d600c2c2ef;hb=4e0fff9935d03469ce6d7484e5f43dddb06e251b;hp=6801c655f3c2c3436660abc2052dc669b134b6e9;hpb=327dfe7647e3720b0f3125f9b19397cb9afc0ed3;p=gdcm.git diff --git a/Testing/TestVR.cxx b/Testing/TestVR.cxx index 6801c655..ab07e894 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/06 20:03:26 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/11/21 12:15:54 $ + Version: $Revision: 1.12 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,16 +16,89 @@ =========================================================================*/ #include "gdcmVR.h" +#include "gdcmDebug.h" int TestVR(int , char *[]) { - gdcm::VR vr; - // There should be 16 entries - vr.Print( std::cout ); + int error = 0; + gdcm::VR *vr = gdcm::VR::New(); + + gdcm::Debug::DebugOn(); - vr.IsVROfStringRepresentable( "" ); - vr.IsVROfBinaryRepresentable( "" ); - vr.IsVROfSequence( "" ); + // We should test the 27 entries ... + vr->Print( std::cout ); - return 0; + // 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::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++; + } + + // 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++; + } + + // 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++; + } + + vr->Delete(); + return error; }