~brianaker/libmemcached/1164440

« back to all changes in this revision

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

  • Committer: Continuous Integration
  • Date: 2012-04-03 15:33:28 UTC
  • mfrom: (991.4.1 workspace)
  • mto: This revision was merged to the branch mainline in revision 992.
  • Revision ID: ci@tangent.org-20120403153328-c3hchrmd2bvfxayb
Merge working tree with build tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
620
620
                                       test_literal_param("foo"),
621
621
                                       test_literal_param("when we sanitize"),
622
622
                                       time_t(0), (uint32_t)0);
623
 
  test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, memcached_strerror(NULL, rc));
 
623
  test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED, memcached_last_error_message(memc));
624
624
 
625
625
  return TEST_SUCCESS;
626
626
}
715
715
       iter != keys.end(); 
716
716
       iter++)
717
717
  {
718
 
    test_compare(MEMCACHED_SUCCESS,
719
 
                 memcached_set(memc,
720
 
                               (*iter), 36,
721
 
                               NULL, 0,
722
 
                               time_t(0), uint32_t(0)));
 
718
    test_compare_hint(MEMCACHED_SUCCESS,
 
719
                      memcached_set(memc,
 
720
                                    (*iter), 36,
 
721
                                    NULL, 0,
 
722
                                    time_t(0), uint32_t(0)),
 
723
                      memcached_last_error_message(memc));
723
724
  }
724
725
 
725
726
  for (ptrdiff_t loop= 0; loop < 20; loop++)
738
739
      {
739
740
        result_count++;
740
741
      }
741
 
      test_compare(keys.size(), result_count);
 
742
      test_true(keys.size() >= result_count);
742
743
    }
743
744
    else
744
745
    {
947
948
 
948
949
test_return_t replace_test(memcached_st *memc)
949
950
{
950
 
  test_compare(return_value_based_on_buffering(memc),
951
 
               memcached_set(memc,
952
 
                             test_literal_param(__func__),
953
 
                             test_literal_param("when we sanitize"),
954
 
                             time_t(0), uint32_t(0)));
 
951
  test_compare_hint(return_value_based_on_buffering(memc),
 
952
                    memcached_set(memc,
 
953
                                  test_literal_param(__func__),
 
954
                                  test_literal_param("when we sanitize"),
 
955
                                  time_t(0), uint32_t(0)),
 
956
                    memcached_last_error_message(memc));
955
957
 
956
 
  test_compare(MEMCACHED_SUCCESS,
957
 
               memcached_replace(memc,
958
 
                                 test_literal_param(__func__),
959
 
                                 test_literal_param("first we insert some data"),
960
 
                                 time_t(0), uint32_t(0)));
 
958
  test_compare_hint(MEMCACHED_SUCCESS,
 
959
                    memcached_replace(memc,
 
960
                                      test_literal_param(__func__),
 
961
                                      test_literal_param("first we insert some data"),
 
962
                                      time_t(0), uint32_t(0)),
 
963
                    memcached_last_error_message(memc));
961
964
 
962
965
  return TEST_SUCCESS;
963
966
}
964
967
 
965
968
test_return_t delete_test(memcached_st *memc)
966
969
{
967
 
  test_compare(return_value_based_on_buffering(memc), 
968
 
               memcached_set(memc, 
969
 
                             test_literal_param(__func__),
970
 
                             test_literal_param("when we sanitize"),
971
 
                             time_t(0), uint32_t(0)));
 
970
  test_compare_hint(return_value_based_on_buffering(memc), 
 
971
                    memcached_set(memc, 
 
972
                                  test_literal_param(__func__),
 
973
                                  test_literal_param("when we sanitize"),
 
974
                                  time_t(0), uint32_t(0)),
 
975
                    memcached_last_error_message(memc));
972
976
 
973
977
  test_compare_hint(return_value_based_on_buffering(memc),
974
978
                    memcached_delete(memc, 
1179
1183
{
1180
1184
  for (uint32_t x= 0; x < 10; x++)
1181
1185
  {
1182
 
    test_compare(return_value_based_on_buffering(memc),
1183
 
                 memcached_set(memc,
1184
 
                               test_literal_param("foo"),
1185
 
                               test_literal_param("train in the brain"),
1186
 
                               time_t(0), uint32_t(0)));
 
1186
    test_compare_hint(return_value_based_on_buffering(memc),
 
1187
                      memcached_set(memc,
 
1188
                                    test_literal_param("foo"),
 
1189
                                    test_literal_param("train in the brain"),
 
1190
                                    time_t(0), uint32_t(0)),
 
1191
                      memcached_last_error_message(memc));
1187
1192
  }
1188
1193
 
1189
1194
  return TEST_SUCCESS;
1538
1543
{
1539
1544
  const char *value= "sanford and sun";
1540
1545
 
1541
 
  test_compare(return_value_based_on_buffering(memc),
1542
 
               memcached_set(memc,
1543
 
                             test_literal_param(__func__),
1544
 
                             value, strlen(value),
1545
 
                             (time_t)10, (uint32_t)3));
 
1546
  test_compare_hint(return_value_based_on_buffering(memc),
 
1547
                    memcached_set(memc,
 
1548
                                  test_literal_param(__func__),
 
1549
                                  value, strlen(value),
 
1550
                                  (time_t)10, (uint32_t)3),
 
1551
                    memcached_last_error_message(memc));
1546
1552
  memcached_quit(memc);
1547
1553
 
1548
 
  test_compare(return_value_based_on_buffering(memc),
1549
 
               memcached_set(memc,
1550
 
                             test_literal_param(__func__),
1551
 
                             value, strlen(value),
1552
 
                             (time_t)50, (uint32_t)9));
 
1554
  test_compare_hint(return_value_based_on_buffering(memc),
 
1555
                    memcached_set(memc,
 
1556
                                  test_literal_param(__func__),
 
1557
                                  value, strlen(value),
 
1558
                                  (time_t)50, (uint32_t)9),
 
1559
                    memcached_last_error_message(memc));
1553
1560
 
1554
1561
  return TEST_SUCCESS;
1555
1562
}
1762
1769
                                         blob, sizeof(blob),
1763
1770
                                         0, 0);
1764
1771
    test_true_got(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED,
1765
 
                  memcached_strerror(NULL, rc));
 
1772
                  memcached_last_error_message(memc));
1766
1773
    test_compare(query_id +1, memcached_query_id(memc));
1767
1774
  }
1768
1775
 
3297
3304
      uint32_t flags;
3298
3305
      char* value=memcached_get(memc, key, strlen(key),
3299
3306
                                &length, &flags, &ret);
3300
 
      test_true_got(ret == MEMCACHED_SUCCESS && value != NULL, memcached_strerror(NULL, ret));
 
3307
      // For the moment we will just go to the next key
 
3308
      if (MEMCACHED_TIMEOUT == ret)
 
3309
      {
 
3310
        continue;
 
3311
      }
 
3312
      test_true_hint(ret == MEMCACHED_SUCCESS and value != NULL, memcached_last_error_message(memc));
3301
3313
      switch (count)
3302
3314
      {
3303
3315
      case 0: /* FALLTHROUGH */
4789
4801
                             0, 0));
4790
4802
  test_true_got(kill(pid, SIGHUP) == 0, strerror(errno));
4791
4803
 
4792
 
  test_compare(MEMCACHED_SUCCESS,
 
4804
  test_compare(MEMCACHED_CONNECTION_FAILURE,
4793
4805
               memcached_set(memc, 
4794
4806
                             test_literal_param(__func__), // Keys
4795
4807
                             test_literal_param(__func__), // Values