im_test.cc 638 字节
Newer Older
S
superjom 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include "visualdl/backend/logic/im.h"

#include "gtest/gtest.h"

namespace visualdl {

class ImTester : public ::testing::Test {
protected:
  void SetUp() override {}

  InformationMaintainer &im = InformationMaintainer::Global();
};

TEST_F(ImTester, AddTablet) { im.AddTablet("tag0", 20); }

TEST_F(ImTester, AddRecord) {
  storage::Record rcd;
  rcd.set_dtype(storage::DataType::kInt32s);
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 10; j++) {
Q
Qiao Longfei 已提交
21
      rcd.add_data()->add_i32s(i * 20 + j);
S
superjom 已提交
22
    }
S
superjom 已提交
23
    im.AddRecord("tag0", rcd);
S
superjom 已提交
24 25 26 27 28
  }

  ASSERT_EQ(im.storage().Find("tag0")->records_size(), 20UL);
}

Q
Qiao Longfei 已提交
29
}  // namespace visualdl