+/* LibMemcached
+ * Copyright (C) 2006-2009 Brian Aker
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary:
+ *
+ */
+
/*
Sample test application.
*/
static char *global_keys[GLOBAL_COUNT];
static size_t global_keys_length[GLOBAL_COUNT];
-static test_return cleanup_pairs(memcached_st *memc __attribute__((unused)))
+static test_return_t cleanup_pairs(memcached_st *memc __attribute__((unused)))
{
pairs_free(global_pairs);
return 0;
}
-static test_return generate_pairs(memcached_st *memc __attribute__((unused)))
+static test_return_t generate_pairs(memcached_st *memc __attribute__((unused)))
{
unsigned long long x;
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
return 0;
}
-static test_return drizzle(memcached_st *memc)
+static test_return_t drizzle(memcached_st *memc)
{
unsigned int x;
- memcached_return rc;
+ memcached_return_t rc;
char *return_value;
size_t return_value_length;
uint32_t flags;
return 0;
}
-static memcached_return pre_nonblock(memcached_st *memc)
+static memcached_return_t pre_nonblock(memcached_st *memc)
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0);
return MEMCACHED_SUCCESS;
}
-static memcached_return pre_md5(memcached_st *memc)
+static memcached_return_t pre_md5(memcached_st *memc)
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MD5);
return MEMCACHED_SUCCESS;
}
-static memcached_return pre_hsieh(memcached_st *memc)
+static memcached_return_t pre_hsieh(memcached_st *memc)
{
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_HSIEH);
return MEMCACHED_SUCCESS;
}
-static memcached_return enable_consistent(memcached_st *memc)
+static memcached_return_t enable_consistent(memcached_st *memc)
{
- memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT;
- memcached_hash hash;
+ memcached_server_distribution_t value= MEMCACHED_DISTRIBUTION_CONSISTENT;
+ memcached_hash_t hash;
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value);
pre_hsieh(memc);
- value= (memcached_server_distribution)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION);
+ value= (memcached_server_distribution_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION);
assert(value == MEMCACHED_DISTRIBUTION_CONSISTENT);
- hash= (memcached_hash)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH);
+ hash= (memcached_hash_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH);
assert(hash == MEMCACHED_HASH_HSIEH);
Set the value, then quit to make sure it is flushed.
Come back in and test that add fails.
*/
-static test_return add_test(memcached_st *memc)
+static test_return_t add_test(memcached_st *memc)
{
- memcached_return rc;
+ memcached_return_t rc;
const char *key= "foo";
const char *value= "when we sanitize";
unsigned long long setting_value;
rc= memcached_set(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
- assert(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
+ test_truth(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
memcached_quit(memc);
rc= memcached_add(memc, key, strlen(key),
value, strlen(value),
/* Too many broken OS'es have broken loopback in async, so we can't be sure of the result */
if (setting_value)
- assert(rc == MEMCACHED_NOTSTORED || rc == MEMCACHED_STORED);
+ {
+ test_truth(rc == MEMCACHED_NOTSTORED || rc == MEMCACHED_STORED);
+ }
else
- assert(rc == MEMCACHED_NOTSTORED);
+ {
+ test_truth(rc == MEMCACHED_NOTSTORED);
+ }
return 0;
}
* repeating add_tests many times
* may show a problem in timing
*/
-static test_return many_adds(memcached_st *memc)
+static test_return_t many_adds(memcached_st *memc)
{
unsigned int i;
for (i = 0; i < TEST_COUNTER; i++)