X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fframework.h;h=361779db7387b5778ac2da80fdc5894738adff3e;hb=cefa03b14574d23cdd2f9db5ff28f210e697042c;hp=45cd6533c1f78fb413617aab8c62cbf69221b655;hpb=8da5675f446c52fa0410edeb8d94ad18201b004b;p=awesomized%2Flibmemcached diff --git a/libtest/framework.h b/libtest/framework.h index 45cd6533..361779db 100644 --- a/libtest/framework.h +++ b/libtest/framework.h @@ -46,21 +46,33 @@ #include +namespace { class Collection; } +typedef std::vector Suites; + +namespace libtest { + class Framework { public: - collection_st *collections; - - /* These methods are called outside of any collection call. */ - test_callback_create_fn *_create; - test_callback_destroy_fn *_destroy; public: test_return_t create(); - /** - If an error occurs during the test, this is called. - */ - test_callback_error_fn *_on_error; + const std::string& name() const + { + return _name; + } + + void create(test_callback_create_fn* arg) + { + _create= arg; + } + + void destroy(test_callback_destroy_fn* arg) + { + _destroy= arg; + } + + void collections(collection_st arg[]); void set_on_error(test_callback_error_fn *arg) { @@ -83,12 +95,6 @@ public: { return _servers; } - - /** - Runner represents the callers for the tests. If not implemented we will use - a set of default implementations. - */ - libtest::Runner *_runner; void set_runner(libtest::Runner *arg) { @@ -101,11 +107,10 @@ public: libtest::Collection& collection(); - Framework(libtest::SignalThread&, const std::string&); - virtual ~Framework(); Framework(libtest::SignalThread&, + const std::string&, const std::string&, const std::string&); @@ -151,20 +156,45 @@ public: return _failed; } -private: - Framework& operator=(const Framework&); + Suites& suites() + { + return _collection; + } +private: uint32_t _total; uint32_t _success; uint32_t _skipped; uint32_t _failed; + + /* These methods are called outside of any collection call. */ + test_callback_create_fn *_create; + test_callback_destroy_fn *_destroy; + + /** + If an error occurs during the test, this is called. + */ + test_callback_error_fn *_on_error; + + /** + Runner represents the callers for the tests. If not implemented we will use + a set of default implementations. + */ + libtest::Runner *_runner; libtest::server_startup_st _servers; bool _socket; void *_creators_ptr; unsigned long int _servers_to_run; - std::vector _collection; + Suites _collection; libtest::SignalThread& _signal; std::string _only_run; std::string _wildcard; + std::string _name; + +private: + Framework( const Framework& ); + const Framework& operator=( const Framework& ); }; + +} // namespace libtest