Fix all include location, and drop versions of the library that were never shipped.
[awesomized/libmemcached] / tests / libmemcached-1.0 / parser.cc
index fc9d3375b3b279b8a18e0c691b5078a31fad25b5..6a75a2dc711ea8033ebe486bd43a099d804b67fa 100644 (file)
@@ -44,8 +44,8 @@ using namespace libtest;
 #include <string>
 #include <cerrno>
 
-#include <libmemcached/memcached.h>
-#include <libmemcached/util.h>
+#include <libmemcached-1.0/memcached.h>
+#include <libmemcachedutil-1.0/util.h>
 
 #include <tests/libmemcached-1.0/parser.h>
 #include <tests/print.h>
@@ -487,7 +487,7 @@ test_return_t random_statement_build_test(memcached_st*)
   {
     std::string random_options;
 
-    uint32_t number_of= random() % option_list.size();
+    uint32_t number_of= random() % uint32_t(option_list.size());
     for (uint32_t options= 0; options < number_of; options++)
     {
       size_t option_list_position= random() % option_list.size();
@@ -663,6 +663,7 @@ test_return_t test_hostname_port_weight(memcached_st *)
 struct socket_weight_t {
   const char *socket;
   size_t weight;
+  const char* type;
 };
 
 static memcached_return_t dump_socket_information(const memcached_st *,
@@ -671,15 +672,27 @@ static memcached_return_t dump_socket_information(const memcached_st *,
 {
   socket_weight_t *check= (socket_weight_t *)context;
 
-  if (strcmp(memcached_server_name(instance), check->socket))
+  if (strcmp(memcached_server_type(instance), check->type) == 0)
   {
-    Error << memcached_server_name(instance) << " != " << check->socket;
-    return MEMCACHED_FAILURE;
+    if (strcmp(memcached_server_name(instance), check->socket) == 0)
+    {
+      if (instance->weight == check->weight)
+      {
+        return MEMCACHED_SUCCESS;
+      }
+      else
+      {
+        Error << instance->weight << " != " << check->weight;
+      }
+    }
+    else
+    {
+      Error << "'" << memcached_server_name(instance) << "'" << " != " << "'" << check->socket << "'";
+    }
   }
-
-  if (instance->weight == check->weight)
+  else
   {
-    return MEMCACHED_SUCCESS;
+    Error << "'" << memcached_server_type(instance) << "'" << " != " << "'" << check->type << "'";
   }
 
   return MEMCACHED_FAILURE;
@@ -697,7 +710,7 @@ test_return_t test_parse_socket(memcached_st *)
 
     memcached_st *memc= memcached(test_literal_param("--socket=\"/tmp/foo\""));
     test_true(memc);
-    socket_weight_t check= { "/tmp/foo", 1 };
+    socket_weight_t check= { "/tmp/foo", 1, "SOCKET"};
     test_compare(MEMCACHED_SUCCESS,
                  memcached_server_cursor(memc, callbacks, &check, 1));
     memcached_free(memc);
@@ -710,7 +723,7 @@ test_return_t test_parse_socket(memcached_st *)
 
     memcached_st *memc= memcached(test_literal_param("--socket=\"/tmp/foo\"/?23"));
     test_true(memc);
-    socket_weight_t check= { "/tmp/foo", 23 };
+    socket_weight_t check= { "/tmp/foo", 23, "SOCKET"};
     test_compare(MEMCACHED_SUCCESS,
                  memcached_server_cursor(memc, callbacks, &check, 1));
     memcached_free(memc);