Correct style, use of newer YATL.
[awesomized/libmemcached] / libtest / framework.h
index 45cd6533c1f78fb413617aab8c62cbf69221b655..7a24466a5ab9c7254d8f4b3a3db4de2155e98a98 100644 (file)
 
 #include <vector>
 
+namespace { class Collection; }
+typedef std::vector<libtest::Collection*> 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<libtest::Collection*> _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