X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Flibmemcached-1.0%2Fplus.cpp;h=145f979765a0612870fb00dcd97cb34d585cb3bd;hb=d9db3f534bc38ea22e83e5529ff93aea4150ab19;hp=8539c5e6dc9fe79c1f3f5d7f1f4d0f004198b8d5;hpb=fe4757c512265eef4f8905b3392f19d33c436ddf;p=awesomized%2Flibmemcached diff --git a/tests/libmemcached-1.0/plus.cpp b/tests/libmemcached-1.0/plus.cpp index 8539c5e6..145f9797 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. + const memcached_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,12 +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->collections(collection); - world->_create= world_create; - world->_destroy= world_destroy; + world->create((test_callback_create_fn*)world_create); + world->destroy((test_callback_destroy_fn*)world_destroy); world->set_runner(new LibmemcachedRunner); }