X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fmemcat.cc;h=3b3b021fd1fa7453012b3c82da603f655d20ace5;hb=62d142cd69b5b6b7e044319085bc011e85dd90eb;hp=e51cdce1451e235e944b626a97cc269cd9d8dc0e;hpb=7773f76bd15be71f7d1a5579006b786584d3fe26;p=awesomized%2Flibmemcached diff --git a/tests/memcat.cc b/tests/memcat.cc index e51cdce1..3b3b021f 100644 --- a/tests/memcat.cc +++ b/tests/memcat.cc @@ -39,10 +39,10 @@ Test that we are cycling the servers we are creating during testing. */ -#include +#include #include -#include +#include using namespace libtest; @@ -64,10 +64,10 @@ static test_return_t help_test(void *) static test_return_t cat_test(void *) { char buffer[1024]; - snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); + int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); const char *args[]= { buffer, "foo", 0 }; - memcached_st *memc= memcached(buffer, strlen(buffer)); + memcached_st *memc= memcached(buffer, length); test_true(memc); test_compare(MEMCACHED_SUCCESS, @@ -77,6 +77,7 @@ static test_return_t cat_test(void *) test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc)); test_compare(MEMCACHED_SUCCESS, rc); + snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc)); @@ -90,11 +91,11 @@ static test_return_t cat_test(void *) static test_return_t NOT_FOUND_test(void *) { char buffer[1024]; - snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); + int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); const char *args[]= { buffer, "foo", 0 }; - memcached_st *memc= memcached(buffer, strlen(buffer)); - test_true(memc); + memcached_st *memc= memcached(buffer, length); + ASSERT_TRUE(memc); test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0)); @@ -102,6 +103,7 @@ static test_return_t NOT_FOUND_test(void *) test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc)); test_compare(MEMCACHED_NOTFOUND, rc); + snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc)); @@ -126,13 +128,13 @@ collection_st collection[] ={ static void *world_create(server_startup_st& servers, test_return_t& error) { - if (HAVE_MEMCACHED_BINARY == 0) + if (libtest::has_memcached() == false) { error= TEST_SKIPPED; return NULL; } - if (not server_startup(servers, "memcached", libtest::default_port(), 0, NULL)) + if (not server_startup(servers, "memcached", libtest::default_port(), NULL)) { error= TEST_FAILURE; } @@ -141,9 +143,9 @@ static void *world_create(server_startup_st& servers, test_return_t& error) } -void get_world(Framework *world) +void get_world(libtest::Framework* world) { - world->collections= collection; - world->_create= world_create; + world->collections(collection); + world->create(world_create); }