All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ExceptionsTest.cpp File Reference

Test file for the class NumericalDerivative. More...

#include <math.h>
#include <stdio.h>
#include <iostream>
#include <exception>
#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

namespace  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 39 of file ExceptionsTest.cpp.

{
std::cout <<
" Test for embedded exceptions ( 2 exception shoudl be catched) "
<< std::endl ;
try {
const GaudiMath::Function& mysin = Genfun::Sin();
// the exception!!! showl be thrown!
const GaudiMath::Function& prim = GaudiMath::Derivative( mysin , 5 );
std::cout << "One should never see this line!! " << std::endl ;
mysin + prim ;
}
catch( const std::exception& e )
{
std::cout << " OK 1) The exception is catched with 'what'='"
<< e.what() << "'" << std::endl;
}
try {
const GaudiMath::Function& mysin = Genfun::Sin();
// the exception!!! showl be thrown!
const GaudiMath::Function& prim = GaudiMath::Derivative( mysin , 10 );
std::cout << "One should never see this line!! " << std::endl ;
mysin + prim ;
}
catch( const GaudiException& e )
{
std::cout << " OK 2) " << e << std::endl ;
}
exit(0);
}