X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Ffunction.c;h=2450b0dd7f7cdc7f5f31170b6688ddd7db92e91f;hb=fdd0e00773ce7928205f725ba5319c94744471a0;hp=9cd10aff18a343c8373eafa8c3ba12cb14e75b17;hpb=97ccdd0fbb452e094e1fcfde80376f805370ff70;p=awesomized%2Flibmemcached diff --git a/tests/function.c b/tests/function.c index 9cd10aff..2450b0dd 100644 --- a/tests/function.c +++ b/tests/function.c @@ -112,7 +112,6 @@ uint8_t set_test(memcached_st *memc) rc= memcached_set(memc, key, strlen(key), value, strlen(value), (time_t)0, (uint16_t)0); - WATCHPOINT_ERROR(rc); assert(rc == MEMCACHED_SUCCESS); return 0; @@ -662,7 +661,7 @@ uint8_t mget_result_test(memcached_st *memc) while ((results= memcached_fetch_result(memc, &results_obj, &rc)) != NULL) assert(!results); - assert(rc == MEMCACHED_NOTFOUND); + assert(rc == MEMCACHED_END); for (x= 0; x < 3; x++) { @@ -712,7 +711,7 @@ uint8_t mget_result_alloc_test(memcached_st *memc) assert(results); } assert(!results); - assert(rc == MEMCACHED_NOTFOUND); + assert(rc == MEMCACHED_END); for (x= 0; x < 3; x++) { @@ -768,7 +767,7 @@ uint8_t mget_test(memcached_st *memc) } assert(!return_value); assert(return_value_length == 0); - assert(rc == MEMCACHED_NOTFOUND); + assert(rc == MEMCACHED_END); for (x= 0; x < 3; x++) { @@ -1225,13 +1224,16 @@ uint8_t user_supplied_bug6(memcached_st *memc) value= memcached_get(memc, keys[0], key_length[0], &value_length, &flags, &rc); assert(value == NULL); + assert(rc == MEMCACHED_NOTFOUND); rc= memcached_mget(memc, keys, key_length, 4); + assert(rc == MEMCACHED_SUCCESS); count= 0; while ((value= memcached_fetch(memc, return_key, &return_key_length, &value_length, &flags, &rc))) count++; assert(count == 0); + assert(rc == MEMCACHED_END); for (x= 0; x < 4; x++) { @@ -1241,7 +1243,7 @@ uint8_t user_supplied_bug6(memcached_st *memc) assert(rc == MEMCACHED_SUCCESS); } - for (x= 0; x < 10; x++) + for (x= 0; x < 2; x++) { value= memcached_get(memc, keys[0], key_length[0], &value_length, &flags, &rc); @@ -1249,14 +1251,17 @@ uint8_t user_supplied_bug6(memcached_st *memc) free(value); rc= memcached_mget(memc, keys, key_length, 4); + assert(rc == MEMCACHED_SUCCESS); count= 3; /* We test for purge of partial complete fetches */ for (count= 3; count; count--) { value= memcached_fetch(memc, return_key, &return_key_length, &value_length, &flags, &rc); - free(value); assert(rc == MEMCACHED_SUCCESS); + assert(!(memcmp(value, insert_data, value_length))); + assert(value_length); + free(value); } } @@ -1667,7 +1672,16 @@ memcached_return pre_hash_ketama(memcached_st *memc) memcached_return enable_consistent(memcached_st *memc) { memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT; + memcached_hash hash; memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, &value); + pre_hsieh(memc); + + value= (memcached_server_distribution)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION); + assert(value == MEMCACHED_DISTRIBUTION_CONSISTENT); + + hash= (memcached_hash)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); + assert(hash == MEMCACHED_HASH_HSIEH); + return MEMCACHED_SUCCESS; } @@ -1861,6 +1875,8 @@ collection_st collection[] ={ {"user", 0, 0, user_tests}, {"generate", 0, 0, generate_tests}, {"generate_hsieh", pre_hsieh, 0, generate_tests}, + {"generate_hsieh_consistent", enable_consistent, 0, generate_tests}, + {"generate_md5", pre_md5, 0, generate_tests}, {"generate_nonblock", pre_nonblock, 0, generate_tests}, {0, 0, 0, 0} };