From: Brian Aker Date: Thu, 19 May 2011 00:42:23 +0000 (-0700) Subject: Added in the better test_compare() X-Git-Tag: 0.51~10^2~13 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=aabf1841b26ae55d04249bb47b91d76e66635f95;p=m6w6%2Flibmemcached Added in the better test_compare() --- diff --git a/libtest/test.h b/libtest/test.h index 656be169..604e661c 100644 --- a/libtest/test.h +++ b/libtest/test.h @@ -222,7 +222,7 @@ do \ { \ if ((A) != (B)) \ { \ - fprintf(stderr, "\n%s:%d: Expected %lu == %lu\n", __FILE__, __LINE__, (unsigned long)(A), (unsigned long)(B)); \ + fprintf(stderr, "\n%s:%d: Expected %s, got %lu\n", __FILE__, __LINE__, #A, (unsigned long)(B)); \ create_core(); \ return TEST_FAILURE; \ } \ diff --git a/tests/mem_functions.cc b/tests/mem_functions.cc index dd5a2569..ca7fb084 100644 --- a/tests/mem_functions.cc +++ b/tests/mem_functions.cc @@ -2547,10 +2547,9 @@ static test_return_t user_supplied_bug9(memcached_st *memc) for (unsigned int x= 0; x < 3; x++) { - memcached_return_t rc; - rc= memcached_set(memc, keys[x], key_length[x], - keys[x], key_length[x], - (time_t)50, (uint32_t)9); + memcached_return_t rc= memcached_set(memc, keys[x], key_length[x], + keys[x], key_length[x], + (time_t)50, (uint32_t)9); test_true(rc == MEMCACHED_SUCCESS); } @@ -2559,13 +2558,13 @@ static test_return_t user_supplied_bug9(memcached_st *memc) /* We need to empty the server before continueing test */ while ((return_value= memcached_fetch(memc, return_key, &return_key_length, - &return_value_length, &flags, &rc)) != NULL) + &return_value_length, &flags, &rc)) != NULL) { test_true(return_value); free(return_value); count++; } - test_true(count == 3); + test_compare(3, count); return TEST_SUCCESS; }