1 #include "test/lib/common.hpp"
2 #include "test/lib/MemcachedCluster.hpp"
4 #include "libmemcached/options.hpp"
5 #include "libmemcached/common.h"
6 #include "libmemcached/array.h"
11 #define FIXTURES_OPTIONS_CONFIG "/../../fixtures/options.config"
13 TEST_CASE("memcached_options") {
15 LoneReturnMatcher test
{*memc
};
17 char cpp_file
[] = __FILE__
, buf
[1024], *dir
= dirname(cpp_file
);
18 auto file
= string(dir
) + FIXTURES_OPTIONS_CONFIG
;
19 auto config
= "--CONFIGURE-FILE=\"" + file
+ "\"";
21 REQUIRE_RC(MEMCACHED_INVALID_ARGUMENTS
, memcached_parse_configure_file(**memc
, nullptr, 123));
22 REQUIRE_RC(MEMCACHED_INVALID_ARGUMENTS
, memcached_parse_configure_file(**memc
, file
.c_str(), 0));
23 REQUIRE_RC(MEMCACHED_ERRNO
, memcached_parse_configure_file(**memc
, S("foobar.baz")));
24 REQUIRE_SUCCESS(memcached_parse_configure_file(**memc
, file
.c_str(), file
.length()));
26 REQUIRE_SUCCESS(libmemcached_check_configuration(config
.c_str(), config
.length(), buf
, sizeof(buf
) - 1));
27 REQUIRE_RC(MEMCACHED_PARSE_ERROR
, libmemcached_check_configuration(S("foo bar"), nullptr, 0));