From: Date: Fri, 4 Apr 2008 07:27:53 +0000 (-0700) Subject: Refactor tests. X-Git-Tag: _20~1^2~27 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=639e4d1a992c9d4b740dc7831f7164be635d892a;p=m6w6%2Flibmemcached Refactor tests. --- diff --git a/libmemcached/memcached_hosts.c b/libmemcached/memcached_hosts.c index f816dd5b..d6832ef3 100644 --- a/libmemcached/memcached_hosts.c +++ b/libmemcached/memcached_hosts.c @@ -116,7 +116,7 @@ memcached_return memcached_server_push(memcached_st *ptr, memcached_server_st *l } ptr->hosts[0].count= ptr->number_of_hosts; - if (ptr->number_of_hosts > 1 && ptr->flags & MEMCACHED_BEHAVIOR_SORT_HOSTS) + if (ptr->number_of_hosts > 1 && ptr->flags & MEM_USE_SORT_HOSTS) qsort(ptr->hosts, ptr->number_of_hosts, sizeof(memcached_server_st), compare_servers); rebalance_wheel(ptr); @@ -180,7 +180,7 @@ static memcached_return server_add(memcached_st *ptr, char *hostname, host_reset(ptr, &ptr->hosts[ptr->number_of_hosts], hostname, port, type); ptr->number_of_hosts++; - if (ptr->number_of_hosts > 1 && ptr->flags & MEMCACHED_BEHAVIOR_SORT_HOSTS) + if (ptr->number_of_hosts > 1 && ptr->flags & MEM_USE_SORT_HOSTS) qsort(ptr->hosts, ptr->number_of_hosts, sizeof(memcached_server_st), compare_servers); ptr->hosts[0].count= ptr->number_of_hosts; diff --git a/tests/function.c b/tests/function.c index 826e6c82..777be74c 100644 --- a/tests/function.c +++ b/tests/function.c @@ -67,7 +67,7 @@ memcached_return server_display_function(memcached_st *ptr, memcached_server_st /* Do Nothing */ uint32_t bigger= *((uint32_t *)(context)); assert(bigger <= server->port); - *((uint32_t *)(context))= bigger; + *((uint32_t *)(context))= server->port; return MEMCACHED_SUCCESS; } @@ -123,7 +123,6 @@ uint8_t server_unsort_test(memcached_st *ptr) local_memc= memcached_create(NULL); assert(local_memc); - memcached_behavior_set(local_memc, MEMCACHED_BEHAVIOR_SORT_HOSTS, 1); for (x= 0; x < TEST_PORT_COUNT; x++) {