]> Creatis software - gdcm.git/blobdiff - Testing/TestVR.cxx
Fix mistypings
[gdcm.git] / Testing / TestVR.cxx
index 6370ad926fb3b312ca6d53d26561c0223178ae2d..46ab1af17d68b19a2c54ba003ed0cbfc988f49da 100644 (file)
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: TestVR.cxx,v $
+  Language:  C++
+  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
+  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_NAME_SPACE::VR *vr = GDCM_NAME_SPACE::VR::New();
+   GDCM_NAME_SPACE::Debug::DebugOn();
 
-   return 0;
+   // We should test the 27 entries ...
+   vr->Print( std::cout );
+
+   // 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++;
+   }
+
+   // 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;
 }