X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Flibmemcached-1.0%2Fplus.cpp;h=34fe7f28be8a663ab6154c90621d78abdb79c84b;hb=23dca174eef8d846e3d4402729b57f6ded035e64;hp=5b3f7e8855a9318b27f6d01685fab5be70582756;hpb=941deb278c78654f9cfeda6f343c79e2f10b746a;p=m6w6%2Flibmemcached diff --git a/tests/libmemcached-1.0/plus.cpp b/tests/libmemcached-1.0/plus.cpp index 5b3f7e88..34fe7f28 100644 --- a/tests/libmemcached-1.0/plus.cpp +++ b/tests/libmemcached-1.0/plus.cpp @@ -35,7 +35,7 @@ * */ -#include +#include /* C++ interface test @@ -203,6 +203,36 @@ static test_return_t mget_test(memcached_st *original) return TEST_SUCCESS; } +static test_return_t lp_1010899_TEST(void*) +{ + // Check to see everything is setup internally even when no initial hosts are + // given. + Memcache memc; + + test_false(memc.increment(__func__, 0, NULL)); + + return TEST_SUCCESS; +} + +static test_return_t lp_1010899_with_args_TEST(memcached_st *original) +{ + // Check to see everything is setup internally even when a host is specified + // on creation. + memcached_server_instance_st instance= memcached_server_instance_by_position(original, 0); + Memcache memc(memcached_server_name(instance), memcached_server_port(instance)); + + test_false(memc.increment(__func__, 0, NULL)); + test_true(memc.set(__func__, test_literal_param("12"), 0, 0)); + test_true(memc.increment(__func__, 3, NULL)); + + std::vector ret_val; + test_true(memc.get(__func__, ret_val)); + + test_strcmp(&ret_val[0], "15"); + + return TEST_SUCCESS; +} + static test_return_t basic_behavior(memcached_st *original) { Memcache memc(original); @@ -273,9 +303,17 @@ test_st tests[] ={ {0, 0, 0} }; +test_st regression_TESTS[] ={ + { "lp:1010899 Memcache()", false, lp_1010899_TEST }, + { "lp:1010899 Memcache(localhost, port)", false, + reinterpret_cast(lp_1010899_with_args_TEST) }, + {0, 0, 0} +}; + collection_st collection[] ={ {"block", 0, 0, tests}, {"error()", 0, 0, error_tests}, + {"regression", 0, 0, regression_TESTS}, {0, 0, 0, 0} }; @@ -284,21 +322,12 @@ collection_st collection[] ={ #define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT +10 #include "tests/libmemcached_world.h" -void get_world(Framework *world) +void get_world(libtest::Framework* world) { - world->collections= collection; - - world->_create= world_create; - world->_destroy= world_destroy; - - world->item._startup= reinterpret_cast(world_test_startup); - world->item._flush= reinterpret_cast(world_flush); - world->item.set_pre(reinterpret_cast(world_pre_run)); - world->item.set_post(reinterpret_cast(world_post_run)); - world->_on_error= reinterpret_cast(world_on_error); + world->collections(collection); - world->collection_startup= reinterpret_cast(world_container_startup); - world->collection_shutdown= reinterpret_cast(world_container_shutdown); + world->create((test_callback_create_fn*)world_create); + world->destroy((test_callback_destroy_fn*)world_destroy); world->set_runner(new LibmemcachedRunner); }