resultBufferTest.cpp 823 字节
Newer Older
H
hjxilinx 已提交
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
#include <gtest/gtest.h>
#include <cassert>
#include <iostream>

#include "taos.h"
#include "qresultBuf.h"
#include "tsdb.h"

namespace {
// simple test
void simpleTest() {
  SDiskbasedResultBuf* pResultBuf = NULL;
  int32_t ret = createDiskbasedResultBuffer(&pResultBuf, 1000, 64);
  
  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);
  
  destroyResultBuf(pResultBuf);
}
} // namespace

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