#include <libmemcached/memcached.h>
#include <tests/debug.h>
+#include <tests/print.h>
/* Dump each server's keys */
static memcached_return_t print_keys_callback(const memcached_st *,
}
-test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value)
+test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value, bool require_all)
{
for (size_t x= 0; x < number_of_keys; ++x)
{
test_string_make_from_cstr(keys[x]), // Keys
&value_length,
0, &rc);
- test_true_got(value, keys[x]);
- if (key_matches_value)
+ if (require_all)
{
- test_strcmp(keys[x], value);
+ test_true_got(value, keys[x]);
+ if (key_matches_value)
+ {
+ test_strcmp(keys[x], value);
+ }
+ }
+ else if (memcached_success(rc))
+ {
+ test_warn_hint(value, keys[x]);
+ if (value and key_matches_value)
+ {
+ test_strcmp(keys[x], value);
+ }
+ }
+
+ if (value)
+ {
+ free(value);
}
- free(value);
}
return TEST_SUCCESS;
memcached_free(clone);
return count;
}
+
+void print_servers(memcached_st *memc)
+{
+ memcached_server_fn callbacks[1];
+ callbacks[0]= server_print_callback;
+ memcached_server_cursor(memc, callbacks, NULL, 1);
+}