X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fframework.cc;h=92aacfeea30a37f117efabfa514285b1ae9f50bb;hb=a6a4d4ef2daccea246d0c026c5e9060c33b38aec;hp=daea4f4ebfa339edd0d88f3847fe30e5dfbcc999;hpb=25efe3485198149616820ab4e52d2f18f0abe5a7;p=awesomized%2Flibmemcached diff --git a/libtest/framework.cc b/libtest/framework.cc index daea4f4e..92aacfee 100644 --- a/libtest/framework.cc +++ b/libtest/framework.cc @@ -34,21 +34,22 @@ * */ -#include +#include "libtest/yatlcon.h" #include #include #include +#include #include #include -using namespace libtest; +namespace libtest { -Framework::Framework(libtest::SignalThread& signal, +Framework::Framework(libtest::SignalThread& signal_, + const std::string& name_, const std::string& only_run_arg, const std::string& wildcard_arg) : - _collections(NULL), _total(0), _success(0), _skipped(0), @@ -59,13 +60,17 @@ Framework::Framework(libtest::SignalThread& signal, _runner(NULL), _socket(false), _creators_ptr(NULL), - _signal(signal), + _signal(signal_), _only_run(only_run_arg), - _wildcard(wildcard_arg) + _wildcard(wildcard_arg), + _name(name_) { get_world(this); +} - for (collection_st *next= _collections; next and next->name; next++) +void Framework::collections(collection_st collections_[]) +{ + for (collection_st *next= collections_; next and next->name; next++) { _collection.push_back(new Collection(this, next)); } @@ -82,12 +87,8 @@ Framework::~Framework() delete _runner; - for (std::vector::iterator iter= _collection.begin(); - iter != _collection.end(); - ++iter) - { - delete *iter; - } + std::for_each(_collection.begin(), _collection.end(), DeleteFromVector()); + _collection.clear(); } bool Framework::match(const char* arg) @@ -132,12 +133,12 @@ void Framework::exec() break; } } - catch (libtest::fatal& e) + catch (const libtest::fatal& e) { _failed++; - stream::cerr(e.file(), e.line(), e.func()) << e.mesg(); + stream::cerr(e.file(), e.line(), e.func()) << e.what(); } - catch (libtest::disconnected& e) + catch (const libtest::disconnected& e) { _failed++; Error << "Unhandled disconnection occurred:" << e.what(); @@ -148,9 +149,9 @@ void Framework::exec() _failed++; throw; } - - Outn(); } + + void xml(const std::string& testsuites_name, std::ostream& output); } uint32_t Framework::sum_total() @@ -226,3 +227,5 @@ test_return_t Framework::create() return rc; } + +} // namespace libtest