X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestUtil.cxx;h=f7b2952c3b6bec67c3d29166fd269f28dbfc151e;hb=d9f8b4b69e332d38e9c883ba60f40dc858883de9;hp=fb9cb97c09203975999fb40d6060ce45e4a57137;hpb=609c6adb9848fef0dc437626b77c72a3fb68d33f;p=gdcm.git diff --git a/Testing/TestUtil.cxx b/Testing/TestUtil.cxx index fb9cb97c..f7b2952c 100644 --- a/Testing/TestUtil.cxx +++ b/Testing/TestUtil.cxx @@ -1,21 +1,191 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestUtil.cxx,v $ + Language: C++ + Date: $Date: 2007/05/23 14:18:06 $ + Version: $Revision: 1.21 $ + + 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. + +=========================================================================*/ // This test should test everything in Util, since I didn't know any other // way to test this class. -#include "gdcm.h" +#include "gdcmUtil.h" +#include "gdcmDebug.h" +#include -int TestUtil(int , char * []) +int TestUtil(int , char *[]) { + unsigned int i; + + // Seeing at a glance HOW int16, int32, float, double, + // are implanted in memory + uint16_t u16 = 0x0102; + uint32_t u32 = 0x01020304; + float flt; + double dbl=1.0; + + std::cout << "This is gdcm version: " << GDCM_NAME_SPACE::Util::GetVersion() << std::endl; + + std::cout << "---------- uint16 : " << std::dec << u16 << " = 0x" + << std::hex << u16 << std::endl; + for (i=0;i [" << y <<"]" << std::endl; + + + // CountSubstring : substring id "#@-" + x = "abcd#@-wyz*@-lmn#@-uvw-#@ijk"; + std::cout << "in [" << x << "] " << std::endl; + std::cout << " - count '#@-' : " + << GDCM_NAME_SPACE::Util::CountSubstring(x, "#@-") << std::endl; + + // Tokenize : tokens are '#', '@', '-' + std::vector tokens; + std::cout << " - use tokens '#@-' :" << std::endl; + GDCM_NAME_SPACE::Util::Tokenize (x, tokens, "#@-"); + for (unsigned int ui=0; ui MD5 : " << GDCM_NAME_SPACE::Util::ConvertToMD5(s1) + < MD5 : " << GDCM_NAME_SPACE::Util::ConvertToMD5(s1) + < MD5 : " << GDCM_NAME_SPACE::Util::ConvertToMD5(s1) + < MD5 : " << GDCM_NAME_SPACE::Util::ConvertToMD5(s1) + < MD5 : " << GDCM_NAME_SPACE::Util::ConvertToMD5(s1) + <