]> Creatis software - gdcm.git/blobdiff - Testing/TestUtil.cxx
Enforce checkings
[gdcm.git] / Testing / TestUtil.cxx
index e74cf0e9dc5834aaba04fa52ef6840ca9fb819be..969d28d78bf0af57e1c05ac67172f9f17b7f1c27 100644 (file)
@@ -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/01/27 12:02:26 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 // 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 <iostream>
 
 int TestUtil(int , char * [])
 {
-   std::cout << gdcm::Util::CreateUniqueUID("") << std::endl;
+   // Time 
+   std::cout << "Time:" << gdcm::Util::GetCurrentDateTime() << std::endl;
+
+   // Processor ID
+   unsigned int processorID;;
+   processorID = gdcm::Util::GetCurrentProcessID();
+   std::cout << "Current Processor ID " <<  processorID << std::endl;
+
+   // MAC Adress
+   std::cout << "Mac Address:" << gdcm::Util::GetMACAddress() << std::endl;
+
+   // Unique UID test
+   std::string gdcmUid;
+   for (int i=0; i<10; i++)
+   {
+      gdcmUid = gdcm::Util::CreateUniqueUID();
+      std::cout << "Current UID for gdcm " <<  gdcmUid << std::endl;
+   }
    
+   // DicomString test
    const char ref[] = "MONOCHROME1";
    std::string a = "MONOCHROME1";
    a += '\0';
@@ -31,10 +51,29 @@ int TestUtil(int , char * [])
    std::string c = gdcm::Util::DicomString("MONOCHROME1");
    std::string d = "MONOCHROME1";
 
-   if( !gdcm::Util::DicomStringEqual(a,ref) ) return 1;
-   if( !gdcm::Util::DicomStringEqual(b,ref) ) return 1;
-   if( !gdcm::Util::DicomStringEqual(c,ref) ) return 1;
-   if(  gdcm::Util::DicomStringEqual(d,ref) ) return 1;
+   if( !gdcm::Util::DicomStringEqual(a,ref) ) 
+      return 1;
+   if( !gdcm::Util::DicomStringEqual(b,ref) ) 
+      return 1;
+   if( !gdcm::Util::DicomStringEqual(c,ref) ) 
+      return 1;
+   if(  gdcm::Util::DicomStringEqual(d,ref) ) 
+      return 1;
+
+// ----------------------------------------------------------
+// Let's test gdcm::Debug, now.
+    std::cout << "GetDebugFlag : " << gdcm::Debug::GetDebugFlag() <<std::endl;
+    gdcm::Debug::SetDebugFilename ("DummyFileNameToWriteTo.txt");
+    std::cout << "We set a Debug file"   <<std::endl;
+    if ( !gdcm::Debug::GetDebugFlag() )
+    {
+       std::cout << "Debug Flag should be TRUE... " << std::endl;
+       return 1;
+    }
+    std::cout << "GetDebugFlag : " << gdcm::Debug::GetDebugFlag()<<std::endl;
+    gdcm::Debug::SetDebugFlag ( false );
+    std::cout << "GetDebugFlag : " << gdcm::Debug::GetDebugFlag()<<std::endl;
+    gdcm::Debug::SetDebugFilename ("DummyFileNameToWriteTo2.txt");    
 
    return 0;
 }