From: Brian Aker Date: Wed, 8 Feb 2012 17:26:15 +0000 (-0800) Subject: Update tests to use generic keys. X-Git-Tag: 1.0.5~71 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=303efaed150e2f832b1e4b31c196a4216cf50732;p=awesomized%2Flibmemcached Update tests to use generic keys. --- diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index ed58daf6..6ffa780d 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -3076,24 +3076,14 @@ static test_return_t _user_supplied_bug21(memcached_st* memc, size_t key_count) /* empty the cache to ensure misses (hence non-responses) */ test_compare(MEMCACHED_SUCCESS, memcached_flush(memc_clone, 0)); - std::vector key_lengths; - key_lengths.resize(key_count); - std::vector keys; - keys.resize(key_lengths.size()); - for (unsigned int x= 0; x < key_lengths.size(); x++) - { - char key[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1]; - int key_length= snprintf(key, sizeof(key), "%u", x); - test_true(key_length > 0 and key_length < MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1); - keys[x]= strdup(key); - key_lengths[x]= key_length; - } + keys_st keys(key_count); oldalarm= signal(SIGALRM, fail); alarm(5); test_compare_got(MEMCACHED_SUCCESS, - memcached_mget(memc_clone, &keys[0], &key_lengths[0], key_count), memcached_last_error_message(memc_clone)); + memcached_mget(memc_clone, keys.keys_ptr(), keys.lengths_ptr(), keys.size()), + memcached_last_error_message(memc_clone)); alarm(0); signal(SIGALRM, oldalarm); @@ -3115,13 +3105,6 @@ static test_return_t _user_supplied_bug21(memcached_st* memc, size_t key_count) test_false(return_key[0]); test_false(return_value); - for (std::vector::iterator iter= keys.begin(); - iter != keys.end(); - iter++) - { - free(*iter); - } - memcached_free(memc_clone); return TEST_SUCCESS;