1 #include "test/lib/common.hpp"
2 #include "test/lib/MemcachedCluster.hpp"
4 TEST_CASE("memcached_prepend") {
5 pair
<string
, MemcachedCluster
> tests
[] = {
6 {"network", MemcachedCluster::network()},
7 {"socket", MemcachedCluster::socket()}
10 LOOPED_SECTION(tests
) {
11 auto memc
= &test
.memc
;
15 REQUIRE_RC(MEMCACHED_NOTSTORED
, memcached_prepend(memc
, S(__func__
), S("fail"), 0, 0));
16 REQUIRE_SUCCESS(memcached_set(memc
, S(__func__
), S("initial"), 0, 0));
17 REQUIRE_SUCCESS(memcached_prepend(memc
, S(__func__
), S("pre1"), 0, 0));
18 REQUIRE_SUCCESS(memcached_prepend(memc
, S(__func__
), S("pre2"), 0, 0));
20 memcached_return_t rc
;
23 char *val
= memcached_get(memc
, S(__func__
), &len
, &flags
, &rc
);
26 REQUIRE("pre2pre1initial" == string(val
, len
));