bin: consolidate clients
[awesomized/libmemcached] / test / tests / memcached / basic.cpp
1 #include "test/lib/common.hpp"
2
3 #include "libmemcached/is.h"
4
5 TEST_CASE("memcached_basic") {
6 SECTION("library") {
7 REQUIRE(string(LIBMEMCACHED_VERSION_STRING) == memcached_lib_version());
8 }
9 SECTION("memcached_st") {
10 memcached_st memc, *memc_ptr;
11
12 memc_ptr = memcached_create(&memc);
13
14 REQUIRE(memc_ptr);
15 REQUIRE(memc_ptr == &memc);
16
17 SECTION("can be cloned") {
18 memc_ptr = memcached_clone(nullptr, &memc);
19 REQUIRE(memc_ptr);
20 REQUIRE(memcached_is_allocated(memc_ptr));
21 memcached_free(memc_ptr);
22 }
23
24 SECTION("can be reset") {
25 memc_ptr = memcached_clone(nullptr, &memc);
26 REQUIRE(MEMCACHED_SUCCESS == memcached_reset(&memc));
27 REQUIRE_FALSE(memcached_is_allocated(&memc));
28 REQUIRE(MEMCACHED_SUCCESS == memcached_reset(memc_ptr));
29 REQUIRE(memcached_is_allocated(memc_ptr));
30 memcached_free(memc_ptr);
31 }
32 }
33 }