~brianaker/libmemcached/1251482

« back to all changes in this revision

Viewing changes to tests/libmemcached-1.0/mem_functions.cc

  • Committer: Continuous Integration
  • Date: 2013-10-11 10:57:29 UTC
  • mfrom: (1169.1.3 key-cleanup)
  • Revision ID: ci@tangent.org-20131011105729-icge7t4g8wr4g380
Merge lp:~brianaker/libmemcached/key-cleanup/ Build: jenkins-Libmemcached-369

Show diffs side-by-side

added added

removed removed

Lines of Context:
993
993
  test_compare(MEMCACHED_SUCCESS,
994
994
               memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true));
995
995
  test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set()
 
996
  ASSERT_TRUE(memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY));
996
997
 
997
998
  /* All keys are valid in the binary protocol (except for length) */
998
999
  if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false)
3081
3082
  const char *key= "mine";
3082
3083
  char *value;
3083
3084
 
3084
 
  /* Make sure be default none exists */
 
3085
  /* Make sure by default none exists */
3085
3086
  value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3086
3087
  test_null(value);
3087
3088
  test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
3092
3093
 
3093
3094
  value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3094
3095
  test_true(value);
3095
 
  test_memcmp(value, key, 4);
 
3096
  test_memcmp(value, key, strlen(key));
3096
3097
  test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
3097
3098
 
3098
3099
  /* Test that we can turn it off */
3110
3111
  value= (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3111
3112
  test_true(value);
3112
3113
  test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
3113
 
  test_memcmp(value, key, 4);
 
3114
  test_memcmp(value, key, strlen(key));
3114
3115
 
3115
3116
  /* Set to Zero, and then Set to something too large */
3116
3117
  {
3120
3121
    test_compare(MEMCACHED_SUCCESS,
3121
3122
                 memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, NULL));
3122
3123
 
3123
 
    value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3124
 
    test_null(value);
3125
 
    test_compare(MEMCACHED_SUCCESS, rc);
 
3124
    ASSERT_NULL_(memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc), "Setting namespace to NULL did not work");
3126
3125
 
3127
3126
    /* Test a long key for failure */
3128
3127
    /* TODO, extend test to determine based on setting, what result should be */
3150
3149
{
3151
3150
  memcached_return_t rc;
3152
3151
  const char *key= "mine";
3153
 
  char *value;
3154
3152
 
3155
3153
  // Make sure we default to a null namespace
3156
 
  value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3157
 
  test_null(value);
 
3154
  char* value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
 
3155
  ASSERT_NULL_(value, "memc had a value for namespace when none should exist");
3158
3156
  test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
3159
3157
 
3160
3158
  /* Test a clean set */
3162
3160
               memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, (void *)key));
3163
3161
 
3164
3162
  value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3165
 
  test_true(value);
3166
 
  test_memcmp(value, key, 4);
 
3163
  ASSERT_TRUE(value);
 
3164
  test_memcmp(value, key, strlen(key));
3167
3165
  test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
3168
3166
 
3169
3167
  return TEST_SUCCESS;