resultBufferTest.cpp 835 字节
Newer Older
H
hjxilinx 已提交
1 2 3 4
#include <gtest/gtest.h>
#include <cassert>
#include <iostream>

H
Haojun Liao 已提交
5
#include "qResultbuf.h"
H
hjxilinx 已提交
6 7 8 9 10 11 12
#include "taos.h"
#include "tsdb.h"

namespace {
// simple test
void simpleTest() {
  SDiskbasedResultBuf* pResultBuf = NULL;
H
hjxilinx 已提交
13
  int32_t ret = createDiskbasedResultBuffer(&pResultBuf, 1000, 64, NULL);
H
hjxilinx 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  
  int32_t pageId = 0;
  int32_t groupId = 0;
  
  tFilePage* pBufPage = getNewDataBuf(pResultBuf, groupId, &pageId);
  ASSERT_TRUE(pBufPage != NULL);
  
  ASSERT_EQ(getNumOfRowsPerPage(pResultBuf), (16384L - sizeof(int64_t))/64);
  ASSERT_EQ(getResBufSize(pResultBuf), 1000*16384L);
  
  SIDList list = getDataBufPagesIdList(pResultBuf, groupId);
  ASSERT_EQ(list.size, 1);
  
  ASSERT_EQ(getNumOfResultBufGroupId(pResultBuf), 1);
  
H
hjxilinx 已提交
29
  destroyResultBuf(pResultBuf, NULL);
H
hjxilinx 已提交
30 31 32 33 34 35
}
} // namespace

TEST(testCase, resultBufferTest) {
  simpleTest();
}