1 #include "test/lib/common.hpp"
2 #include "test/lib/MemcachedCluster.hpp"
4 TEST_CASE("memcached_value_flags") {
5 auto test
= MemcachedCluster::mixed();
6 auto memc
= &test
.memc
;
7 const auto size
= 1048064lu;
8 auto blob
= make_unique
<char[]>(size
);
10 SECTION("set & get flags") {
11 uint32_t flag
= GENERATE(123, 456, 789, UINT32_MAX
);
13 REQUIRE_SUCCESS(memcached_set(memc
, S(__func__
), blob
.get(), size
, 0, flag
));
17 memcached_return_t rc
;
18 Malloced
val(memcached_get(memc
, S(__func__
), &len
, &flg
, &rc
));
24 len
= strlen(__func__
);
26 char key
[MEMCACHED_MAX_KEY
];
27 memcpy(key
, fun
, strlen(fun
) + 1);
28 const char *keys
[1] = {key
};
29 REQUIRE_SUCCESS(memcached_mget(memc
, keys
, &len
, 1));
30 while (auto rv
= memcached_fetch(memc
, key
, nullptr, &len
, &flg
, &rc
)) {
33 REQUIRE_FALSE(memcmp(rv
, blob
.get(), len
));
37 REQUIRE_RC(MEMCACHED_END
, rc
);