X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestUtil.cxx;h=5f45350d5ce86217687f6d82bda08ea6bb0704d2;hb=0e88aff6bcac1c201b50acb285ba079f3a6b1a6c;hp=e74cf0e9dc5834aaba04fa52ef6840ca9fb819be;hpb=5ce83ba7ad93f458923e5f3b7aa406651db90637;p=gdcm.git diff --git a/Testing/TestUtil.cxx b/Testing/TestUtil.cxx index e74cf0e9..5f45350d 100644 --- a/Testing/TestUtil.cxx +++ b/Testing/TestUtil.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestUtil.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 04:28:20 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/11/30 11:40:26 $ + Version: $Revision: 1.19 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -18,12 +18,128 @@ // 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 *[]) { - std::cout << gdcm::Util::CreateUniqueUID("") << std::endl; + 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::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::Util::CountSubstring(x, "#@-") << std::endl; + + // Tokenize : tokens are '#', '@', '-' + std::vector tokens; + std::cout << " - use tokens '#@-' :" << std::endl; + gdcm::Util::Tokenize (x, tokens, "#@-"); + for (unsigned int ui=0; ui