update TODO
[awesomized/libmemcached] / test / tests / memcached / prepend.cpp
1 #include "test/lib/common.hpp"
2 #include "test/lib/MemcachedCluster.hpp"
3
4 TEST_CASE("memcached_prepend") {
5 pair<string, MemcachedCluster> tests[] = {
6 {"network", MemcachedCluster::network()},
7 {"socket", MemcachedCluster::socket()}
8 };
9
10 LOOPED_SECTION(tests) {
11 auto memc = &test.memc;
12
13 test.flush();
14
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));
19
20 memcached_return_t rc;
21 uint32_t flags;
22 size_t len;
23 char *val = memcached_get(memc, S(__func__), &len, &flags, &rc);
24 Malloced v(val);
25 REQUIRE_SUCCESS(rc);
26 REQUIRE("pre2pre1initial" == string(val, len));
27 }
28 }