提交 c8a1bd65 编写于 作者: S superjom

fix set_mode

add_mode
上级 3f43ac4c
......@@ -10,7 +10,7 @@ const static std::string kDefaultMode{"default"};
class LogWriter {
public:
LogWriter(const std::string& dir, int sync_cycle) {
LogWriter(const std::string& dir, int sync_cycle) {
storage_.SetDir(dir);
storage_.meta.cycle = sync_cycle;
}
......@@ -20,7 +20,10 @@ public:
storage_ = other.storage_;
}
void SetMode(const std::string& mode) { mode_ = mode; }
void SetMode(const std::string& mode) {
mode_ = mode;
storage_.AddMode(mode);
}
LogWriter AsMode(const std::string& mode) {
LogWriter writer = *this;
......
......@@ -31,6 +31,8 @@ TEST(Scalar, write) {
// check the first entry of first record
ASSERT_EQ(record.front(), 12);
ASSERT_TRUE(!reader.storage().modes().empty());
// check tags
ASSERT_EQ(reader.all_tags().size(), 1);
auto tags = reader.tags("scalar");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册