Skip to content

Commit

Permalink
Merge pull request #7 from lambdaliu/fix_test
Browse files Browse the repository at this point in the history
fix test
  • Loading branch information
lambdaliu authored Sep 29, 2021
2 parents ada280d + 2ecf7f3 commit 1393e92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/logger_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ TEST_F(LoggerTest, TestFileShift) {
logger->SetLogLevel(kTraceLogLevel);

const char *text = "test logger file shift";
logger->Log(LOG_INFO, text);
logger->Log(LOG_INFO, "%s\n", text);
ASSERT_TRUE(FileUtils::FileExists(log_path_ + "/" + log_file_name_));
ASSERT_TRUE(logger->log_file_ != NULL);
ASSERT_TRUE(logger->cur_file_size_ > 0);

int text_log_size = logger->cur_file_size_;
int log_count = max_file_size_ / text_log_size + 1;
for (int i = 0; i < log_count; ++i) {
logger->Log(LOG_INFO, text);
logger->Log(LOG_INFO, "%s\n", text);
}
ASSERT_TRUE(logger->log_file_ != NULL);
ASSERT_TRUE(logger->cur_file_size_ <= max_file_size_ + text_log_size);
ASSERT_TRUE(FileUtils::FileExists(log_path_ + "/" + log_file_name_ + ".0"));

log_count = log_count * (max_file_no_ + 1); // 足够序号重复滚动
for (int i = 0; i < log_count; ++i) {
logger->Log(LOG_INFO, text);
logger->Log(LOG_INFO, "%s\n", text);
}
ASSERT_TRUE(logger->log_file_ != NULL);
ASSERT_TRUE(logger->cur_file_size_ <= max_file_size_ + text_log_size);
Expand Down

0 comments on commit 1393e92

Please sign in to comment.