Refactored tests.
[awesomized/libmemcached] / tests / plus.cpp
index 32dbcf0b17ec7117b86b41bb131f669a5d9bb023..cb0b0837893531a72e90a9478cacd822ab3020ab 100644 (file)
@@ -11,6 +11,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <time.h>
+#include "server.h"
 
 #include "test.h"
 
@@ -39,7 +40,36 @@ collection_st collection[] ={
   {0, 0, 0, 0}
 };
 
-collection_st *gets_collections(void)
+#define SERVERS_TO_CREATE 1
+
+void *world_create(void)
+{
+  unsigned int x;
+  memcached_server_st *servers;
+  server_startup_st *construct;
+
+  construct= (server_startup_st *)malloc(sizeof(server_startup_st));
+  memset(construct, 0, sizeof(server_startup_st));
+
+  construct->count= SERVERS_TO_CREATE;
+  server_startup(construct);
+
+  return construct;
+}
+
+void world_destroy(void *p)
+{
+  server_startup_st *construct= (server_startup_st *)p;
+  memcached_server_st *servers= (memcached_server_st *)construct->servers;
+  memcached_server_list_free(servers);
+
+  server_shutdown(construct);
+  free(construct);
+}
+
+void get_world(world_st *world)
 {
-  return collection;
+  world->collections= collection;
+  world->create= world_create;
+  world->destroy= world_destroy;
 }