patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -17,39 +17,39 @@
#define OK(s) ASSERT_EQ(OB_SUCCESS, (s));
#define NOT_EXIST(s) ASSERT_EQ(OB_ENTRY_NOT_EXIST, (s))
namespace oceanbase {
namespace oceanbase
{
using namespace storage;
using namespace common;
namespace unittest {
class TestHandleCache : public ::testing::Test {};
namespace unittest
{
class TestHandleCache : public ::testing::Test
{
};
class TestKey {
class TestKey
{
public:
TestKey()
{}
TestKey(const int key) : key_(key)
{}
uint64_t hash() const
{
return key_;
}
int64_t to_string(char* buf, int64_t buf_len) const
TestKey() {}
TestKey(const int key) : key_(key) {}
uint64_t hash() const { return key_; }
int64_t to_string(char *buf, int64_t buf_len) const
{
UNUSED(buf);
UNUSED(buf_len);
return 0;
}
bool operator==(const TestKey& key) const
bool operator == (const TestKey &key) const
{
return key_ == key.key_;
}
int key_;
};
class TestHandle {
class TestHandle
{
public:
void reset()
{}
void reset() {}
int v_;
};
@ -78,7 +78,7 @@ TEST_F(TestHandleCache, basic)
OK(handle_cache.put_handle(key, handle));
OK(handle_cache.get_handle(key, handle));
ASSERT_EQ(64, handle.v_);
key.key_ = 0;
key.key_= 0;
OK(handle_cache.get_handle(key, handle));
ASSERT_EQ(0, handle.v_);
@ -88,10 +88,10 @@ TEST_F(TestHandleCache, basic)
OK(handle_cache.put_handle(key, handle));
OK(handle_cache.get_handle(key, handle));
ASSERT_EQ(32, handle.v_);
key.key_ = 0;
key.key_= 0;
OK(handle_cache.get_handle(key, handle));
ASSERT_EQ(0, handle.v_);
key.key_ = 64;
key.key_= 64;
OK(handle_cache.get_handle(key, handle));
ASSERT_EQ(64, handle.v_);
@ -112,10 +112,10 @@ TEST_F(TestHandleCache, basic)
ASSERT_EQ(3, handle.v_);
key.key_ = 32;
NOT_EXIST(handle_cache.get_handle(key, handle));
key.key_ = 0;
key.key_= 0;
OK(handle_cache.get_handle(key, handle));
ASSERT_EQ(0, handle.v_);
key.key_ = 64;
key.key_= 64;
OK(handle_cache.get_handle(key, handle));
ASSERT_EQ(64, handle.v_);
@ -131,10 +131,10 @@ TEST_F(TestHandleCache, basic)
ASSERT_EQ(4, handle_cache.lru_list_.get_size());
}
} // namespace unittest
} // namespace oceanbase
}
}
int main(int argc, char** argv)
int main(int argc, char **argv)
{
OB_LOGGER.set_log_level("INFO");
testing::InitGoogleTest(&argc, argv);