The Gaudi Framework  v29r0 (ff2e7097)
ExceptionsTest.cpp File Reference

Test file for the class NumericalDerivative. More...

#include <cmath>
#include <cstdio>
#include <exception>
#include <iostream>
#include "GaudiKernel/GaudiException.h"
#include "GaudiKernel/SystemOfUnits.h"
#include "GaudiMath/GaudiMath.h"
#include "CLHEP/GenericFunctions/Sin.hh"
Include dependency graph for ExceptionsTest.cpp:

Go to the source code of this file.

Namespaces

 CLHEP
 

Functions

int main ()
 

Detailed Description

Test file for the class NumericalDerivative.

Date
2003-08-31
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Definition in file ExceptionsTest.cpp.

Function Documentation

int main ( )

Definition at line 40 of file ExceptionsTest.cpp.

41 {
42 
43  std::cout << " Test for embedded exceptions ( 2 exception shoudl be catched) " << std::endl;
44 
45  try {
46  const GaudiMath::Function& mysin = Genfun::Sin();
47  // the exception!!! showl be thrown!
48  const GaudiMath::Function& prim = GaudiMath::Derivative( mysin, 5 );
49  std::cout << "One should never see this line!! " << std::endl;
50  mysin + prim;
51  } catch ( const std::exception& e ) {
52  std::cout << " OK 1) The exception is catched with 'what'='" << e.what() << "'" << std::endl;
53  }
54 
55  try {
56  const GaudiMath::Function& mysin = Genfun::Sin();
57  // the exception!!! showl be thrown!
58  const GaudiMath::Function& prim = GaudiMath::Derivative( mysin, 10 );
59  std::cout << "One should never see this line!! " << std::endl;
60  mysin + prim;
61  } catch ( const GaudiException& e ) {
62  std::cout << " OK 2) " << e << std::endl;
63  }
64 }
Define general base for Gaudi exception.
T endl(T...args)
Genfun::AbsFunction Function
Definition: GaudiMath.h:24
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
Definition: GaudiMath.h:27
T what(T...args)
STL class.