resultBufferTest.cpp 854 字节
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
Haojun Liao 已提交
13
  int32_t ret = createDiskbasedResultBuffer(&pResultBuf, 1000, 64, 1024, 4, NULL);
H
hjxilinx 已提交
14 15 16 17 18 19 20 21 22 23 24
  
  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);
H
Haojun Liao 已提交
25
  ASSERT_EQ(taosArrayGetSize(list), 1);
H
hjxilinx 已提交
26 27
  ASSERT_EQ(getNumOfResultBufGroupId(pResultBuf), 1);
  
H
hjxilinx 已提交
28
  destroyResultBuf(pResultBuf, NULL);
H
hjxilinx 已提交
29 30 31 32 33 34
}
} // namespace

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