fstUtilUT.cc 1.6 KB
Newer Older
dengyihao's avatar
dengyihao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

#include <gtest/gtest.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <thread>
#include <vector>
#include "index.h"
#include "indexCache.h"
#include "indexFst.h"
#include "indexFstDfa.h"
#include "indexFstRegex.h"
#include "indexFstSparse.h"
#include "indexFstUtil.h"
#include "indexInt.h"
#include "indexTfile.h"
#include "tglobal.h"
#include "tlog.h"
#include "tskiplist.h"
#include "tutil.h"
class FstUtilEnv : public ::testing::Test {
 protected:
  virtual void SetUp() {
    SArray *inst = taosArrayInit(4, sizeof(char));
    builder = dfaBuilderCreate(inst);
  }
  virtual void TearDown() { dfaBuilderDestroy(builder); }

  FstDfaBuilder *builder;
};

class FstRegexEnv : public ::testing::Test {
 protected:
  virtual void SetUp() { regex = regexCreate("test"); }
  virtual void TearDown() { regexDestroy(regex); }
  FstRegex    *regex;
};

class FstSparseSetEnv : public ::testing::Test {
 protected:
dengyihao's avatar
dengyihao 已提交
41 42 43 44 45 46 47 48 49
  virtual void SetUp() { set = sparSetCreate(256); }
  virtual void TearDown() {
    // tear down
    sparSetDestroy(set);
  }
  void ReBuild(int32_t sz) {
    sparSetDestroy(set);
    set = sparSetCreate(sz);
  }
dengyihao's avatar
dengyihao 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
  FstSparseSet *set;
};

// test FstDfaBuilder
TEST_F(FstUtilEnv, test1) {}
TEST_F(FstUtilEnv, test2) {}
TEST_F(FstUtilEnv, test3) {}
TEST_F(FstUtilEnv, test4) {}

// test FstRegex

TEST_F(FstRegexEnv, test1) {}
TEST_F(FstRegexEnv, test2) {}
TEST_F(FstRegexEnv, test3) {}
TEST_F(FstRegexEnv, test4) {}

// test FstSparseSet
TEST_F(FstSparseSetEnv, test1) {}
TEST_F(FstSparseSetEnv, test2) {}
TEST_F(FstSparseSetEnv, test3) {}
TEST_F(FstSparseSetEnv, test4) {}