Skip to content

Commit

Permalink
test(server): adding unit tests for reply builder
Browse files Browse the repository at this point in the history
Signed-off-by: Boaz Sade <[email protected]>
  • Loading branch information
boazsade committed Feb 12, 2023
1 parent c065f92 commit fb4a605
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/facade/reply_builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ std::string_view GetErrorType(std::string_view err) {
class RedisReplyBuilderTest : public testing::Test {
public:
struct ParsingResults {
RedisParser::Result results = RedisParser::OK;
RedisParser::Result result = RedisParser::OK;
RespExpr::Vec args;
std::uint32_t consumed = 0;

bool Verify(std::uint32_t expected) const {
return consumed == expected && results == RedisParser::OK;
return consumed == expected && result == RedisParser::OK;
}

bool IsError() const {
Expand All @@ -65,11 +65,11 @@ class RedisReplyBuilderTest : public testing::Test {
}

bool IsNull() const {
return results == RedisParser::OK && args.size() == 1 && args.at(0).type == RespExpr::NIL;
return result == RedisParser::OK && args.size() == 1 && args.at(0).type == RespExpr::NIL;
}

bool IsString() const {
return args.size() == 1 && results == RedisParser::OK && args[0].type == RespExpr::STRING;
return args.size() == 1 && result == RedisParser::OK && args[0].type == RespExpr::STRING;
}
};

Expand Down Expand Up @@ -150,7 +150,7 @@ std::vector<std::string_view> RedisReplyBuilderTest::TokenizeMessage() const {
}

std::ostream& operator<<(std::ostream& os, const RedisReplyBuilderTest::ParsingResults& res) {
os << "result{consumed bytes:" << res.consumed << ", status: " << res.results << " result count "
os << "result{consumed bytes:" << res.consumed << ", status: " << res.result << " result count "
<< res.args.size() << ", first entry result: ";
if (!res.args.empty()) {
if (res.args.size() > 1) {
Expand All @@ -173,7 +173,7 @@ RedisReplyBuilderTest::ParsingResults RedisReplyBuilderTest::Parse() {
memcpy(ptr, str().data(), SinkSize());
RedisParser parser(false); // client side
std::string_view tmp_view{str()};
result.results =
result.result =
parser.Parse(RedisParser::Buffer{ptr, SinkSize()}, &result.consumed, &result.args);
return result;
}
Expand Down

0 comments on commit fb4a605

Please sign in to comment.