X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ffunction.c;h=fb2f4bca42cd7caff2c898f7988f6296172e2f9e;hb=b369db6ab57bc940618281a2be848542a406bb7c;hp=5e37153783d90b2a404338f76ad2da12a9c5a5d6;hpb=d5ffc30a6f369ea210e92e6a55333121d32b9a55;p=awesomized%2Flibmemcached diff --git a/tests/function.c b/tests/function.c index 5e371537..fb2f4bca 100644 --- a/tests/function.c +++ b/tests/function.c @@ -2003,6 +2003,32 @@ test_return user_supplied_bug15(memcached_st *memc) return 0; } +/* Check the return sizes on FLAGS to make sure it stores 32bit unsigned values correctly */ +test_return user_supplied_bug16(memcached_st *memc) +{ + memcached_return rc; + char *key= "mykey"; + char *value; + size_t length; + uint32_t flags; + + rc= memcached_set(memc, key, strlen(key), + NULL, 0, + (time_t)0, UINT32_MAX); + + assert(rc == MEMCACHED_SUCCESS); + + value= memcached_get(memc, key, strlen(key), + &length, &flags, &rc); + + assert(rc == MEMCACHED_SUCCESS); + assert(value == NULL); + assert(length == 0); + assert(flags == UINT32_MAX); + + return 0; +} + test_return result_static(memcached_st *memc) { memcached_result_st result; @@ -2496,6 +2522,20 @@ memcached_return set_prefix(memcached_st *memc) assert(rc == MEMCACHED_SUCCESS); assert(memcmp(value, key, 4) == 0); + /* Set to Zero, and then Set to something too large */ + { + char *long_key= "This is more then the allotted number of characters"; + rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL); + assert(rc == MEMCACHED_SUCCESS); + + value= memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc); + assert(rc == MEMCACHED_FAILURE); + assert(value == NULL); + + rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); + assert(rc == MEMCACHED_BAD_KEY_PROVIDED); + } + return MEMCACHED_SUCCESS; } @@ -2745,6 +2785,7 @@ test_st user_tests[] ={ {"user_supplied_bug13", 1, user_supplied_bug13 }, {"user_supplied_bug14", 1, user_supplied_bug14 }, {"user_supplied_bug15", 1, user_supplied_bug15 }, + {"user_supplied_bug16", 1, user_supplied_bug16 }, {0, 0, 0} };