]> Creatis software - gdcm.git/blob - Testing/TestDictGroupName.cxx
Fix mistypings
[gdcm.git] / Testing / TestDictGroupName.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: TestDictGroupName.cxx,v $
5   Language:  C++
6   Date:      $Date: 2007/05/23 14:18:06 $
7   Version:   $Revision: 1.5 $
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 "gdcmDictGroupName.h"
19 #include "gdcmGlobal.h"
20 #include "gdcmCommon.h"
21
22 #include <iomanip>
23
24 int CompareDictGroupName(GDCM_NAME_SPACE::DictGroupName *groupName,
25                          uint16_t group,std::string ref)
26 {
27    std::string val = groupName->GetName(group);
28    std::cout << "Group : 0x" << std::hex << std::setw(4) << group 
29              << std::dec << " : " << val << " - "
30              << (bool)(val==ref) << std::endl;
31
32    return val!=ref;
33 }
34
35 int TestDictGroupName(int , char *[])
36 {
37    GDCM_NAME_SPACE::DictGroupName *groupName = GDCM_NAME_SPACE::DictGroupName::New();
38    groupName->Print( std::cout );
39
40    int ret = 0;
41
42    std::cout << std::endl;
43    ret += CompareDictGroupName(groupName,0x0002,"Meta Elements");
44    ret += CompareDictGroupName(groupName,0x7fe0,"Pixels");
45    ret += CompareDictGroupName(groupName,0x0007,GDCM_NAME_SPACE::GDCM_UNFOUND);
46
47    groupName->Delete();
48
49    return ret;
50 }