1 #include "test/lib/common.hpp"
2 #include "test/lib/Shell.hpp"
3 #include "test/lib/Server.hpp"
4 #include "test/lib/Retry.hpp"
5 #include "test/lib/ReturnMatcher.hpp"
7 using Catch::Matchers::Contains
;
9 TEST_CASE("bin/memerror") {
10 Shell sh
{string
{TESTING_ROOT
"/../src/bin"}};
14 REQUIRE(sh
.run("memerror --help", output
));
15 REQUIRE_THAT(output
, Contains("memerror"));
16 REQUIRE_THAT(output
, Contains("v1"));
17 REQUIRE_THAT(output
, Contains("help"));
18 REQUIRE_THAT(output
, Contains("version"));
19 REQUIRE_THAT(output
, Contains("option"));
20 REQUIRE_THAT(output
, Contains("--"));
21 REQUIRE_THAT(output
, Contains("="));
24 SECTION("valid error codes") {
25 for (underlying_type_t
<memcached_return_t
> rc
= MEMCACHED_SUCCESS
; rc
< MEMCACHED_MAXIMUM_RETURN
; ++rc
) {
27 REQUIRE(sh
.run("memerror " + to_string(rc
), output
));
28 CHECK(output
== memcached_strerror(nullptr, static_cast<memcached_return_t
>(rc
)) + string
{"\n"});
32 SECTION("unknown error code") {
34 REQUIRE_FALSE(sh
.run("memerror " + to_string(MEMCACHED_MAXIMUM_RETURN
), output
));
35 REQUIRE_THAT(output
, Contains("INVALID memcached_return_t"));