#pragma once
#include <chrono>
+#include <cstring>
#include <iostream>
#include <map>
#include <optional>
for (auto &[name, test] : tests) DYNAMIC_SECTION("test " << name)
#define REQUIRE_SUCCESS(rc) \
do { \
- INFO("expected: SUCCESS"); \
REQUIRE_THAT(rc, test.returns.success()); \
} while (0)
#define REQUIRE_RC(rc, call) \
do { \
- INFO("expected: " << memcached_strerror(nullptr, rc)); \
REQUIRE_THAT(call, test.returns(rc)); \
} while (0)
bool put(const char *buf, size_t len) const {
return static_cast<ssize_t>(len) == write(fd, buf, len);
}
+ string get() const {
+ string all;
+ char buf[200];
+ ssize_t len;
+
+ lseek(fd, 0, SEEK_SET);
+ while (0 < (len = read(fd, buf, sizeof(buf)))) {
+ all.append(buf, len);
+ }
+ return all;
+ }
private:
char fn[80];