]> Creatis software - gdcm.git/commitdiff
I tried to make a Test for gdcm::Exception
authorjpr <jpr>
Fri, 11 Feb 2005 16:42:23 +0000 (16:42 +0000)
committerjpr <jpr>
Fri, 11 Feb 2005 16:42:23 +0000 (16:42 +0000)
I never could even compile.
Replace by myExecption ...
How can it work?

Testing/TestException.cxx [new file with mode: 0644]

diff --git a/Testing/TestException.cxx b/Testing/TestException.cxx
new file mode 100644 (file)
index 0000000..312ed87
--- /dev/null
@@ -0,0 +1,60 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: TestException.cxx,v $
+  Language:  C++
+  Date:      $Date: 2005/02/11 16:42:23 $
+  Version:   $Revision: 1.1 $
+                                                                                
+  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.
+                                                                                
+=========================================================================*/
+
+#include "gdcmException.h"
+#include "gdcmDebug.h"
+#include "gdcmGlobal.h"
+#include "gdcmCommon.h"
+
+struct myException
+{
+   std::string error;
+
+   myException( std::string ErrorMessage )
+   {
+      error = ErrorMessage;
+   }
+   void Print() { std::cerr << "Pfff!" << error << std::endl; }
+};
+
+
+
+void functionForException()  throw ( myException );
+  
+void functionForException() 
+     throw ( myException )
+{
+      throw myException("in functionForException : ");
+}
+
+
+
+
+int TestException(int , char **)
+{  
+   try
+   {
+      functionForException();
+   }
+   catch (myException)
+   {
+      std::cout << "Exception 'myException' received" << std::endl;
+   }
+
+return 0;
+}