Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

RunTests.cc

Go to the documentation of this file.
00001 /* -*- Mode:C++ -*- */
00002 #include <iostream>
00003 #include <sstream>
00004 #include <complex>
00005 
00006 #include <popt.h>
00007 
00008 #include <TestSuite.hh>
00009 
00010 #include "StackTest.hh"
00011 #include "SuiteTest.hh"
00012 
00013 #include "TestSuiteFormatterDoxygen.hh"
00014 
00015 // Use the command-line to change the debug_level
00016 int debug_level = 0;
00017 int version_flag;
00018 int do_doxygen = 0;
00019 
00020 int
00021 main(int argc, char **argv)
00022 {
00023 // {{{ Parse command-line
00024   int help = 0;
00025   int usage = 0;
00026   int rc;
00027 
00028   poptContext optCon;   /* context for parsing command-line options */
00029 
00030   struct poptOption optionsTable[] = {
00031     { "debug", 'd', POPT_ARG_INT, &debug_level, 0,
00032       "set debugging level [0]", "LEVEL" },
00033     { "doxygen", 0, POPT_ARG_NONE, &do_doxygen, 0, 
00034       "Generate for inclusion in Doxygen documentation", 0 },
00035     POPT_AUTOHELP
00036     { NULL, 0, 0, NULL, 0 }
00037   };
00038 
00039   optCon = poptGetContext(NULL, argc, (const char**)argv, optionsTable, 0);
00040   // poptSetOtherOptionHelp(optCon, "[OPTIONS]* <port>");
00041 
00042   if ((rc = poptGetNextOpt(optCon)) < -1) {
00043     fprintf(stderr, "popt2: bad argument %s: %s\n", 
00044             poptBadOption(optCon, POPT_BADOPTION_NOALIAS), 
00045             poptStrerror(rc));
00046     return 2;
00047   }
00048 
00049   if (help) {
00050     poptPrintHelp(optCon, stdout, 0);
00051     return 0;
00052   }
00053 
00054   if (usage) {
00055     poptPrintUsage(optCon, stdout, 0);
00056     return 0;
00057   }
00058 
00059 // }}}
00060 
00061   ccunit::TestSuite testSuite("libccunit Unit Tests");
00062 
00063   // add the unit tests
00064   testSuite.Add(ccunit::TestComponentPtr(new StackTest));
00065 
00066   // add an different suite to this one
00067   ccunit::TestSuite *s = new ccunit::TestSuite("Suite Test");
00068     
00069   s->Add(ccunit::TestComponentPtr(new ComplexTest));
00070   s->Add(ccunit::TestComponentPtr(new VoidTest));
00071   
00072   testSuite.Add(ccunit::TestComponentPtr(s));
00073 
00074   // All we need to do is print the output
00075   if (do_doxygen) {
00076     testSuite.setFormatter(ccunit::TestSuiteFormatterPtr(new ccunit::TestSuiteFormatterDoxygen()));
00077   }
00078 
00079   cout << testSuite << endl;
00080 }

Generated on Tue Apr 2 15:33:22 2002 for libccunit by doxygen 1.2.14 written by Dimitri van Heesch, © 1997-2002

Project hosted on sourceforge SourceForge Logo