X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestHash.cxx;h=771b7bba472031e7f9a304d8c0b019e3f7ddb0c9;hb=14900333988858a95935ec735224433cf308c21c;hp=463352494bcdea2309c84076aaa579c3d9b4d89c;hpb=796a5c818b5ae284a382313ffe5bf31d4c402dba;p=gdcm.git diff --git a/Testing/TestHash.cxx b/Testing/TestHash.cxx index 46335249..771b7bba 100644 --- a/Testing/TestHash.cxx +++ b/Testing/TestHash.cxx @@ -1,3 +1,4 @@ +// Checks the basic functionalities of STL . #include #include #include @@ -5,34 +6,46 @@ int TestHash( int, char * [] ) { - typedef std::map dict; - + std::cout << "Test::TestHash : " << std::endl; + std::cout << " Checks that the basic STL functionalities required " + << std::endl + << " by gdcm are operational. " << std::endl; + + typedef std::map dict; dict tb1; + + // Adding entries by key: + dict::iterator im = tb1.find("00380010"); tb1["00100010"] = "Patient Name"; tb1["7fe00010"] = "Pixel Data"; tb1["50000010"] = "Number of points"; tb1["00380010"] = "Admission ID"; - std::cout << "Traversal of dictionary (note the proper ordering on key)." << std::endl; + // Travesing the dictionary: + + std::cout << " Traversal of dictionary (note the proper ordering on key):" + << std::endl; for ( im = tb1.begin(); im != tb1.end(); ++im ) - std::cout << " \"" << im->first << "\" = " << im->second << std::endl; - std::cout << "End of dictionary." << std::endl; + std::cout << " \"" << im->first << "\" = " << im->second + << std::endl; + std::cout << " End of dictionary." << std::endl; - std::cout << "Find request on key 00380010" << std::endl; + // Find request. + + std::cout << " Find request on key 00380010" << std::endl; im = tb1.find("00380010"); - std::cout << " \"" << im->first << "\" = " << im->second << std::endl; - + std::cout << " \"" << im->first << "\" = " << im->second << std::endl; + + // The following should print in hexadecimal an in decimal the given + // integer as stated by: + // http://www.developer.com/net/cplus/article.php/10919_2119781_3 + // Alas it doesn't work with g++ (at least)... int i = 0x0010; std::cout.setf(std::ios::hex); - std::cout << i << std::endl; + std::cout << "Test::TestHash : hexdecimal output : " << i << std::endl; std::cout.setf(std::ios::dec); - std::cout << i << std::endl; - - // Voir : - //http://www.developer.com/net/cplus/article.php/10919_2119781_3 - // - // dommage que ca ne marche pas ... - - return 0; + std::cout << "Test::TestHash : decimal output : " << i << std::endl; + + return 0; }