// -*- mode: C++; tab-width: 4; indent-tabs-mode: t; -*- vim:ts=4:sw=4 // // Copyright(c) Chong Kai Xiong (descender) // // This file is part of The Plains of Usata. // // The Plains of Usata is licensed under the GNU General Public // License (GPL) version 2. For details, please see the COPYING file // included in the software distribution, or visit // http://www.fsf.org/licenses/gpl.html. // // $Id: test.cpp,v 1.1 2005/01/03 09:47:14 Descender Exp $ #include #include #include "test.hpp" namespace usata { namespace test { // FIXME: add statistics! - descender bool run(const std::string& name, Function function) throw() { std::cout << boost::format("Testing %1% ... ") % name; try { (*function)(); std::cout << "ok" << std::endl; return true; } catch (Error& error) { std::cout << "failed!" << std::endl; std::cerr << "Expression failed: " << error.what() << std::endl; return false; } catch (...) { std::cout << "failed!" << std::endl; std::cerr << "Unknown exception!" << std::endl; return false; } } } }