]> Creatis software - gdcm.git/blob - Testing/TestVR.cxx
Fix mistypings
[gdcm.git] / Testing / TestVR.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: TestVR.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/05/23 14:18:06 $
7   Version:   $Revision: 1.13 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18 #include "gdcmVR.h"
19 #include "gdcmDebug.h"
20
21 int TestVR(int , char *[])
22 {
23    int error = 0;
24    GDCM_NAME_SPACE::VR *vr = GDCM_NAME_SPACE::VR::New();
25  
26    GDCM_NAME_SPACE::Debug::DebugOn();
27
28    // We should test the 27 entries ...
29    vr->Print( std::cout );
30
31    // Valid VR
32    if( !vr->IsValidVR( "PN" ) )
33    {
34       std::cerr << "'PN' is not recognized as a valid VR" << std::endl;
35       error++;
36    }
37    if( !vr->IsValidVR( "FD" ) )
38    {
39       std::cerr << "'FD' is not recognized as a valid VR" << std::endl;
40       error++;
41    }
42    if( vr->IsValidVR( "" ) )
43    {
44       std::cerr << "'' is recognized as a valid VR" << std::endl;
45       error++;
46    }
47    if( vr->IsValidVR( "  " ) )
48    {
49       std::cerr << "'  ' is recognized as a valid VR" << std::endl;
50       error++;
51    }
52    if( vr->IsValidVR( "\000/" ) )
53    {
54       std::cerr << "' /' is recognized as a valid VR" << std::endl;
55       error++;
56    }
57    if( vr->IsValidVR( GDCM_NAME_SPACE::GDCM_VRUNKNOWN ) )
58    {
59       std::cerr << "'  ' is recognized as a valid VR" << std::endl;
60       error++;
61    }
62
63    // String representable
64    //---------------------
65    if( !vr->IsVROfStringRepresentable( "PN" ) )
66    {
67       std::cerr << "'PN' is not recognized as a string representable" << std::endl;
68       error++;
69    }
70    if( vr->IsVROfStringRepresentable( "OB" ) )
71    {
72       std::cerr << "'OB' is recognized as a string representable" << std::endl;
73       error++;
74    }
75
76    // Binary representable
77    //---------------------
78    if( !vr->IsVROfBinaryRepresentable( "OB" ) )
79    {
80       std::cerr << "OB is not recognized as a binary representable" << std::endl;
81       error++;
82    }
83    if( vr->IsVROfBinaryRepresentable( "PN" ) )
84    {
85       std::cerr << "'PN' is a binary representable" << std::endl;
86       error++;
87    }
88
89    // Sequence
90    //---------
91    if( vr->IsVROfSequence( "" ) )
92    {
93       std::cerr << "'' is a sequence" << std::endl;
94       error++;
95    }
96    if( !vr->IsVROfSequence( "SQ" ) )
97    {
98       std::cerr << "'SQ' is not recognized as a Sequence" << std::endl;
99       error++;
100    }
101
102    vr->Delete();
103    return error;
104 }