- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Solvers/SAT/GATSAT/CompileSAT/CSATTestSuite.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00010
    00011 #include <Mers/Solvers/SAT/GATSAT/TestSuiteParser.hpp>
    00012 #include <Mers/Solvers/SAT/GATSAT/TestSuiteLexer.hpp>
    00013
    00014 #include "CSATFactory.h"
    00015
    00016 #include <antlr/NoViableAltException.hpp>
    00017 #include <antlr/TokenStreamException.hpp>
    00018
    00019 #include <fstream>
    00020
    00022
    00023 using namespace Mers::Solvers::SAT::GATSAT::CompileSAT;
    00024 using Mers::Solvers::SAT::GATSAT::TestSuiteParser;
    00025 using Mers::Solvers::SAT::GATSAT::TestSuiteLexer;
    00026 using std::ifstream;
    00027 using std::cerr;
    00028 using std::endl;
    00029
    00031
    00032 int main(int argc, const char * argv[])
    00033 {
    00034         const char * fileName = "TestCase0.tests";
    00035         const char * configFile = "logTestSuite.conf";
    00036
    00037         if(argc >= 2) {
    00038                 fileName = argv[1];
    00039         }
    00040         if(argc >= 3) {
    00041                 configFile = argv[2];
    00042         }
    00043
    00044         // load our config file
    00045         if(configFile == NULL) {
    00046                 log4cplus::BasicConfigurator::doConfigure();
    00047         } else {
    00048                 log4cplus::PropertyConfigurator::doConfigure(configFile);
    00049         }
    00050
    00051         log4cplus::BasicConfigurator::doConfigure();
    00052
    00053         ifstream ifs(fileName);
    00054
    00055         TestSuiteLexer lex(ifs);
    00056
    00057         TestSuiteParser parser(lex);
    00058
    00059         try {
    00060                 CSATFactory csFactory;
    00061                 parser.startTests(csFactory);
    00062         } catch(ANTLR_USE_NAMESPACE(antlr)NoViableAltException & nvaExc) {
    00063                 cerr << "Exception thrown: " << nvaExc.getMessage() << endl;
    00064         } catch(ANTLR_USE_NAMESPACE(antlr)NoViableAltException * nvaExc) {
    00065                 cerr << "Exception thrown: " << nvaExc->getMessage() << endl;
    00066         } catch(ANTLR_USE_NAMESPACE(antlr)RecognitionException & recExc) {
    00067                 cerr << "Exception thrown: " << recExc.toString() << endl;
    00068         } catch(ANTLR_USE_NAMESPACE(antlr)TokenStreamException & tsExc) {
    00069                 cerr << "Exception thrown: " << tsExc.toString() << endl;
    00070         } catch(...) {
    00071                 cerr << "Other Exception" << endl;
    00072         }
    00073
    00074         return 0;
    00075 }
    00076