/*========================================================================= Program: GDCM (Grassroots DICOM). A DICOM library Copyright (c) 2006-2011 Mathieu Malaterre All rights reserved. See Copyright.txt or http://gdcm.sourceforge.net/Copyright.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 notice for more information. =========================================================================*/ #include "gdcmTag.h" #include "gdcmSwapper.h" int TestPrivate() { gdcm::Tag t1(0x0009,0x0000); if( t1.IsPublic() ) { return 1; } if( !t1.IsPrivate() ) { return 1; } if( t1.IsPrivateCreator() ) { return 1; } gdcm::Tag t2(0x0009,0x0001); if( t2.IsPublic() ) { return 1; } if( !t2.IsPrivate() ) { return 1; } if( t2.IsPrivateCreator() ) { return 1; } gdcm::Tag t3(0x0009,0x0010); if( t3.IsPublic() ) { return 1; } if( !t3.IsPrivate() ) { return 1; } if( !t3.IsPrivateCreator() ) { return 1; } gdcm::Tag t4(0x0009,0x1010); gdcm::Tag t4_creator(0x0009,0x0010); if( t4.IsPublic() ) { return 1; } if( !t4.IsPrivate() ) { return 1; } if( t4.IsPrivateCreator() ) { return 1; } if( t4.GetPrivateCreator() != t4_creator ) { return 1; } return 0; } int TestPipePrintRead() { gdcm::Tag t(0x1234,0x5678); const char pipesep[] = "1234|5678"; gdcm::Tag tprime(0x0,0x0); if( !tprime.ReadFromPipeSeparatedString(pipesep) ) { return 1; } if( tprime != t ) return 1; std::string str = t.PrintAsPipeSeparatedString(); if( str != pipesep ) return 1; return 0; } int TestOperator() { gdcm::Tag t1(0x1234,0x5678); gdcm::Tag t1bis(0x1234,0x5678); gdcm::Tag t2(0x1234,0x5679); if( t2 < t1 ) { return 1; } if( !(t1 < t2) ) { return 1; } if( !(t1 == t1bis) ) { return 1; } if( !(t1 <= t1bis) ) { return 1; } return 0; } int TestTag(int , char * []) { { const uint32_t dummy = 0x12345678; gdcm::Tag t16(0x1234, 0x5678); std::stringstream ss; t16.Write( ss ); gdcm::Tag t16_2; t16_2.Read( ss ); gdcm::Tag t32( dummy ); if( t32 != t16 ) { return 1; } gdcm::Tag t1; gdcm::Tag t2(0,0); if ( t1[0] != 0 ) { std::cerr << "1" << std::endl; return 1; } if (t1[1] != 0 ) {std::cout << "2" << std::endl ; return 1; } if (t2[0] != 0 ) {std::cout << "3" << std::endl ; return 1; } if (t2[1] != 0 ) {std::cout << "4" << std::endl ; return 1; } if ( !(t1 == t2) ) {std::cout << "5" << std::endl ; return 1; } if ( t1 != t2 ) {std::cout << "6" << std::endl ; return 1; } if ( t1 < t2 ) {std::cout << "7" << std::endl ; return 1; } unsigned int i; const uint32_t tag = dummy; std::cout << "Just to inform : uint32_t value=" << std::hex << tag ; std::cout << " stored in RAM as :"; for (i=0;i> tag2; //std::istringstream is; //is.str( "1234567890" ); //is >> tag2; if( tag != tag2 ) { std::cout << tag << std::endl; std::cout << tag2 << std::endl; return 1; } } return 0; }