LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_example.cc
Go to the documentation of this file.
1 // example for LCIO tests
4 
5 #include "tutil.h"
6 #include "lcio.h"
7 
8 #include "EVENT/LCIO.h"
9 #include "IO/LCWriter.h"
10 #include "IMPL/LCEventImpl.h"
11 #include "IMPL/LCCollectionVec.h"
12 
13 #include <iostream>
14 
15 using namespace std ;
16 using namespace lcio ;
17 
18 // replace mytest with the name of your test
19 const static string testname="mytest";
20 
21 //=============================================================================
22 
23 int main(int /*argc*/, char** /*argv*/ ){
24 
25  // this should be the first line in your test
26  TEST MYTEST=TEST( testname, std::cout );
27 
28  // write your test here
29  for( int i=0; i<3; i++){
30  MYTEST.LOG( "this is just a test..." );
31  }
32 
33  //if( true ){
34  if( false ){
35  // force test program to fail in this way:
36  MYTEST.FAILED( "oops, something went wrong..." );
37  }
38 
39  // example with a try&catch fail condition:
40  //
42  //LCReader* lcReader = LCFactory::getInstance()->createLCReader() ;
43  //try{
44  // lcReader->open( "blub.slcio" ) ;
45  //}
46  //catch( Exception &e ){
47  // MYTEST.FAILED( e.what() );
48  //}
49  //lcReader->close();
50  //delete lcReader;
52 
53  return 0;
54 }
55 
56 //=============================================================================
57 
Definition: tutil.h:7
void FAILED(const std::string &msg)
Definition: tutil.h:42
static const string testname
Definition: test_example.cc:19
int main(int argc, char **argv)
Simple program that opens existing LCIO files and appends the records needed for direct access - if t...
void LOG(const std::string &msg)
Definition: tutil.h:21