The Gaudi Framework
v26r1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
ExceptionsTest.cpp
Go to the documentation of this file.
1
// $Id: ExceptionsTest.cpp,v 1.2 2006/12/08 12:15:20 hmd Exp $
2
// ============================================================================
3
// Include files
4
// ============================================================================
5
// STD & STL
6
// ============================================================================
7
#include <math.h>
8
#include <stdio.h>
9
#include <iostream>
10
#include <exception>
11
// ============================================================================
12
// GaudiKernel
13
// ============================================================================
14
#include "GaudiKernel/GaudiException.h"
15
#include "GaudiKernel/SystemOfUnits.h"
16
// ============================================================================
17
// GaudiMath
18
// ============================================================================
19
#include "GaudiMath/GaudiMath.h"
20
// ============================================================================
21
// CLHEP
22
// ============================================================================
23
#include "CLHEP/GenericFunctions/Sin.hh"
24
// ============================================================================
25
// Handle CLHEP 2.0.x move to CLHEP namespace
26
namespace
CLHEP { }
27
using namespace
CLHEP;
28
29
// ============================================================================
37
// ============================================================================
38
39
int
main
()
40
{
41
42
std::cout <<
43
" Test for embedded exceptions ( 2 exception shoudl be catched) "
44
<< std::endl ;
45
46
try
{
47
const
GaudiMath::Function
& mysin = Genfun::Sin();
48
// the exception!!! showl be thrown!
49
const
GaudiMath::Function
& prim =
GaudiMath::Derivative
( mysin , 5 );
50
std::cout <<
"One should never see this line!! "
<< std::endl ;
51
mysin + prim ;
52
}
53
catch
(
const
std::exception& e )
54
{
55
std::cout <<
" OK 1) The exception is catched with 'what'='"
56
<< e.what() <<
"'"
<< std::endl;
57
}
58
59
try
{
60
const
GaudiMath::Function
& mysin = Genfun::Sin();
61
// the exception!!! showl be thrown!
62
const
GaudiMath::Function
& prim =
GaudiMath::Derivative
( mysin , 10 );
63
std::cout <<
"One should never see this line!! "
<< std::endl ;
64
mysin + prim ;
65
}
66
catch
(
const
GaudiException
& e )
67
{
68
std::cout <<
" OK 2) "
<< e << std::endl ;
69
}
70
71
exit(0);
72
73
}
74
75
// ============================================================================
76
// The END
77
// ============================================================================
GaudiGSL
src
Tests
ExceptionsTest.cpp
Generated on Mon Feb 16 2015 11:56:54 for The Gaudi Framework by
1.8.2