Introduce list_family_test

This commit is contained in:
Roman Gershman 2022-01-04 10:47:49 +02:00
parent 6b7ed73753
commit 5a7a67fbcf
2 changed files with 44 additions and 0 deletions

View file

@ -14,5 +14,6 @@ add_library(dfly_test_lib test_utils.cc)
cxx_link(dfly_test_lib dragonfly_lib gtest_main_ext)
cxx_test(redis_parser_test dfly_test_lib LABELS DFLY)
cxx_test(list_family_test dfly_test_lib LABELS DFLY)
cxx_test(string_family_test dfly_test_lib LABELS DFLY)
cxx_test(memcache_parser_test dfly_test_lib LABELS DFLY)

View file

@ -0,0 +1,43 @@
// Copyright 2021, Roman Gershman. All rights reserved.
// See LICENSE for licensing terms.
//
#include "server/list_family.h"
#include <absl/strings/match.h>
#include "base/gtest.h"
#include "base/logging.h"
#include "server/command_registry.h"
#include "server/conn_context.h"
#include "server/engine_shard_set.h"
#include "server/string_family.h"
#include "server/test_utils.h"
#include "server/transaction.h"
#include "util/uring/uring_pool.h"
using namespace testing;
using namespace std;
using namespace util;
using namespace boost;
namespace dfly {
class ListFamilyTest : public BaseFamilyTest {
protected:
};
const char* kKey1 = "x";
const char* kKey2 = "b";
TEST_F(ListFamilyTest, Basic) {
auto resp = Run({"lpush", kKey1, "1"});
EXPECT_THAT(resp[0], IntArg(1));
resp = Run({"lpush", kKey2, "2"});
ASSERT_THAT(resp[0], IntArg(1));
resp = Run({"llen", kKey1});
ASSERT_THAT(resp[0], IntArg(1));
}
} // namespace dfly