User Manual, Developers Guide and API Documentation

TestFixture.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 16, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #include <WNS/TestFixture.hpp>
00029 #include <WNS/simulator/ISimulator.hpp>
00030 
00031 #include <iostream>
00032 
00033 using namespace wns;
00034 
00035 void
00036 TestFixture::setUp()
00037 {
00038     try
00039     {
00040         wns::simulator::getInstance()->reset();
00041         this->prepare();
00042     }
00043     catch (const wns::Exception& e)
00044     {
00045         std::cerr << "\n"
00046                   << "A wns::Exception occured during prepare(): \n"
00047                   << e.what() << "\n";
00048         throw;
00049     }
00050     catch (const std::exception& e)
00051     {
00052         std::cerr << "\n"
00053                   << "An std::exception occured during prepare(): \n"
00054                   << e.what() << "\n";
00055         throw;
00056     }
00057 }
00058 
00059 void
00060 TestFixture::tearDown()
00061 {
00062     try
00063     {
00064         this->cleanup();
00065         // any global cleanup stuff must follow after local cleanup
00066         // stuff ...
00067     }
00068     catch (const wns::Exception& e)
00069     {
00070         std::cerr << "\n"
00071                   << "wns::Exception thrown in wns::TestFixture::cleanup(): \n"
00072                   << e.what() << "\n";
00073         throw;
00074     }
00075     catch (const std::exception& e)
00076     {
00077         std::cerr << "\n"
00078                   << "std::exception thrown in wns::TestFixture::cleanup(): \n"
00079                   << e.what() << "\n";
00080         throw;
00081     }
00082 }
00083 
00084 std::string
00085 wns::failureMessage(const std::string& sourceFile, const std::string& sourceLine, const std::string& expected, const std::string& actual)
00086 {
00087     return "Line " + sourceLine + " in " + sourceFile + "\n" +
00088         "- Expected: " + expected + "\n" +
00089         "- Actual  : " + actual + "\n";
00090 }
00091 
00092 std::string
00093 wns::testsuite::Disabled()
00094 {
00095     return "wns::testsuite::Disabled";
00096 }
00097 
00098 std::string
00099 wns::testsuite::Default()
00100 {
00101     return "wns::testsuite::Default";
00102 }
00103 
00104 std::string
00105 wns::testsuite::Performance()
00106 {
00107     return "wns::testsuite::Performance";
00108 }
00109 
00110 std::string
00111 wns::testsuite::Spike()
00112 {
00113     return "wns::testsuite::Spike";
00114 }

Generated on Sat May 26 03:31:53 2012 for openWNS by  doxygen 1.5.5