Fix all include location, and drop versions of the library that were never shipped.
[awesomized/libmemcached] / tests / memerror.cc
index 88ddcbadf311a8e3e82c7513420f17c1e89f3227..9b3ddd353ab9236d9097e8c12a700e6c10b9d35a 100644 (file)
@@ -42,7 +42,7 @@
 #include <config.h>
 
 #include <libtest/test.hpp>
-#include <libmemcached/memcached.h>
+#include <libmemcached-1.0/memcached.h>
 
 using namespace libtest;
 
@@ -50,44 +50,58 @@ using namespace libtest;
 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
 #endif
 
-static std::string executable;
+static std::string executable("./clients/memerror");
 
-static test_return_t quiet_test(void *)
+static test_return_t help_TEST(void *)
 {
-  const char *args[]= { "--quiet", 0 };
+  const char *args[]= { "--help", 0 };
+
+  test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
 
-  test_true(exec_cmdline(executable, args));
   return TEST_SUCCESS;
 }
 
-static test_return_t help_test(void *)
+static test_return_t version_TEST(void *)
 {
-  const char *args[]= { "--quiet", "--help", 0 };
+  const char *args[]= { "--version", 0 };
+
+  test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
 
-  test_true(exec_cmdline(executable, args));
   return TEST_SUCCESS;
 }
 
 static test_return_t error_test(void *)
 {
-  const char *args[]= { "--quiet", "MEMCACHED_SUCCESS", 0 };
+  const char *args[]= { "memcached_success", 0 };
+
+  test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
+
+  return TEST_SUCCESS;
+}
+
+static test_return_t SUCCESS_TEST(void *)
+{
+  const char *args[]= { "0", 0 };
+
+  test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
 
-  test_true(exec_cmdline(executable, args));
   return TEST_SUCCESS;
 }
 
 static test_return_t bad_input_test(void *)
 {
-  const char *args[]= { "--quiet", "bad input", 0 };
+  const char *args[]= { "bad input", 0 };
+
+  test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
 
-  test_true(exec_cmdline(executable, args));
   return TEST_SUCCESS;
 }
 
 test_st memerror_tests[] ={
-  {"--quiet", 0, quiet_test},
-  {"--help", 0, help_test},
+  {"--help", 0, help_TEST},
+  {"--version", 0, version_TEST},
   {"<error>", 0, error_test},
+  {"0", 0, SUCCESS_TEST},
   {"<bad input>", 0, bad_input_test},
   {0, 0, 0}
 };
@@ -97,16 +111,21 @@ collection_st collection[] ={
   {0, 0, 0, 0}
 };
 
-static void *world_create(server_startup_st&, test_return_t&)
+static void *world_create(server_startup_st&, test_return_t& error)
 {
+  if (libtest::has_memcached() == false)
+  {
+    error= TEST_SKIPPED;
+    return NULL;
+  }
+
   return NULL;
 }
 
 
-void get_world(Framework *world)
+void get_world(libtest::Framework* world)
 {
-  executable= "./clients/memerror";
-  world->collections= collection;
-  world->_create= world_create;
+  world->collections(collection);
+  world->create(world_create);
 }