![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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/testing/DetailedListener.hpp> 00029 00030 #include <iostream> 00031 #include <iomanip> 00032 00033 using namespace wns::testing; 00034 00035 void 00036 DetailedListener::startTest(CppUnit::Test* test) 00037 { 00038 failed = false; 00039 std::cout << "\033[01;35m[TST]\033[00m ";; 00040 std::string testName = test->getName(); 00041 int length = testName.length(); 00042 std::string padding = ""; 00043 if (length < 90) 00044 { 00045 std::cout << testName; 00046 padding.append(90 - length, ' '); 00047 std::cout << padding; 00048 } 00049 else 00050 { 00051 testName.erase(0, length-86); 00052 std::cout << "..." << testName << " "; 00053 } 00054 std::cout.flush(); 00055 00056 sw = wns::StopWatch(); 00057 sw.start(); 00058 } 00059 00060 void 00061 DetailedListener::addFailure(const CppUnit::TestFailure&) 00062 { 00063 failed = true; 00064 } 00065 00066 void 00067 DetailedListener::endTest(CppUnit::Test* /*test*/) 00068 { 00069 sw.stop(); 00070 00071 if (failed) 00072 { 00073 std::cout << "\033[01;31m[FAILED]\033[00m"; 00074 } 00075 else 00076 { 00077 std::cout << "\033[01;32m[OK]\033[00m"; 00078 } 00079 std::cout << " " 00080 << std::setiosflags(std::ios::right) 00081 << std::setiosflags(std::ios::fixed) 00082 << std::setiosflags(std::ios::dec) 00083 << std::setprecision(6) 00084 << std::setw(10) 00085 << sw.getInSeconds() << " s" << std::endl; 00086 } 00087
1.5.5