bin: consolidate clients
[awesomized/libmemcached] / test / tests / memcached / strings.cpp
1 #include "test/lib/common.hpp"
2
3 TEST_CASE("memcached_strings") {
4 SECTION("behaviors") {
5 string bad_string{libmemcached_string_behavior(MEMCACHED_BEHAVIOR_MAX)};
6 for (auto b = 0; b < MEMCACHED_BEHAVIOR_MAX; ++b) {
7 auto chk_string = libmemcached_string_behavior(static_cast<memcached_behavior_t>(b));
8 INFO("missing entry for memcached_behavior_t(" << b << ")?");
9 REQUIRE(chk_string);
10 REQUIRE(bad_string != chk_string);
11 }
12 }
13 SECTION("distributions") {
14 string bad_string{libmemcached_string_distribution(MEMCACHED_DISTRIBUTION_CONSISTENT_MAX)};
15 for (auto d = 0; d < MEMCACHED_DISTRIBUTION_CONSISTENT_MAX; ++d) {
16 auto chk_string = libmemcached_string_distribution(static_cast<memcached_server_distribution_t>(d));
17 INFO("missing entry for memcached_server_distribution_t(" << d << ")?");
18 REQUIRE(chk_string);
19 REQUIRE(bad_string != chk_string);
20 }
21 }
22 SECTION("return codes") {
23 MemcachedPtr memc;
24 string bad_string{memcached_strerror(*memc, MEMCACHED_MAXIMUM_RETURN)};
25 for (auto r = 0; r < MEMCACHED_MAXIMUM_RETURN; ++r) {
26 auto chk_string = memcached_strerror(*memc, static_cast<memcached_return_t>(r));
27 INFO("missing entry for memcached_return_t(" << r << ")?");
28 REQUIRE(chk_string);
29 REQUIRE(bad_string != chk_string);
30 }
31 }
32 }