storage_test.cc 638 字节
Newer Older
S
superjom 已提交
1
#include "visualdl/storage/storage.h"
S
superjom 已提交
2 3

#include <gtest/gtest.h>
S
superjom 已提交
4
#include <memory>
S
superjom 已提交
5 6

namespace visualdl {
S
superjom 已提交
7
class StorageTest : public ::testing::Test {
S
superjom 已提交
8
public:
S
superjom 已提交
9 10 11 12
  void SetUp() {
    storage.SetDir("./tmp/storage_test");
    storage.meta.cycle = 2;
  }
S
superjom 已提交
13

S
superjom 已提交
14
  Storage storage;
S
superjom 已提交
15 16
};

S
superjom 已提交
17
TEST_F(StorageTest, main) {
S
superjom 已提交
18 19
  storage.AddMode("train");
  storage.AddMode("test");
S
superjom 已提交
20

S
superjom 已提交
21 22 23 24 25
  auto tag0 = storage.AddTablet("tag0");
  auto tag1 = storage.AddTablet("tag1");

  StorageReader reader("./tmp/storage_test");
  auto modes = reader.Modes();
S
superjom 已提交
26

S
superjom 已提交
27 28 29
  ASSERT_EQ(modes.size(), 2);
  ASSERT_EQ(modes[0], "train");
  ASSERT_EQ(modes[1], "test");
S
superjom 已提交
30 31 32
}

}  // namespace visualdl