[td-225] fix bugs in test cases.
This commit is contained in:
parent
31349ebbae
commit
5a448cd9a3
|
@ -90,9 +90,9 @@ SIDList getDataBufPagesIdList(SDiskbasedResultBuf* pResultBuf, int32_t groupId);
|
||||||
//#define getResBufPage(buf, id) ((tFilePage*)((buf)->pBuf + (buf)->pageSize * (id)))
|
//#define getResBufPage(buf, id) ((tFilePage*)((buf)->pBuf + (buf)->pageSize * (id)))
|
||||||
static FORCE_INLINE tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
|
static FORCE_INLINE tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
|
||||||
if (id < pResultBuf->inMemPages) {
|
if (id < pResultBuf->inMemPages) {
|
||||||
return pResultBuf->iBuf + id * pResultBuf->pageSize;
|
return (tFilePage*) ((char*) pResultBuf->iBuf + id * pResultBuf->pageSize);
|
||||||
} else {
|
} else {
|
||||||
return pResultBuf->pBuf + (id - pResultBuf->inMemPages) * pResultBuf->pageSize;
|
return (tFilePage*) ((char*) pResultBuf->pBuf + (id - pResultBuf->inMemPages) * pResultBuf->pageSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace {
|
||||||
// simple test
|
// simple test
|
||||||
void simpleTest() {
|
void simpleTest() {
|
||||||
SDiskbasedResultBuf* pResultBuf = NULL;
|
SDiskbasedResultBuf* pResultBuf = NULL;
|
||||||
int32_t ret = createDiskbasedResultBuffer(&pResultBuf, 1000, 64, NULL);
|
int32_t ret = createDiskbasedResultBuffer(&pResultBuf, 1000, 64, 1024, 4, NULL);
|
||||||
|
|
||||||
int32_t pageId = 0;
|
int32_t pageId = 0;
|
||||||
int32_t groupId = 0;
|
int32_t groupId = 0;
|
||||||
|
@ -22,8 +22,7 @@ void simpleTest() {
|
||||||
ASSERT_EQ(getResBufSize(pResultBuf), 1000*16384L);
|
ASSERT_EQ(getResBufSize(pResultBuf), 1000*16384L);
|
||||||
|
|
||||||
SIDList list = getDataBufPagesIdList(pResultBuf, groupId);
|
SIDList list = getDataBufPagesIdList(pResultBuf, groupId);
|
||||||
ASSERT_EQ(list.size, 1);
|
ASSERT_EQ(taosArrayGetSize(list), 1);
|
||||||
|
|
||||||
ASSERT_EQ(getNumOfResultBufGroupId(pResultBuf), 1);
|
ASSERT_EQ(getNumOfResultBufGroupId(pResultBuf), 1);
|
||||||
|
|
||||||
destroyResultBuf(pResultBuf, NULL);
|
destroyResultBuf(pResultBuf, NULL);
|
||||||
|
|
|
@ -35,12 +35,12 @@ extern "C" {
|
||||||
#define WCHAR wchar_t
|
#define WCHAR wchar_t
|
||||||
|
|
||||||
#define tfree(x) \
|
#define tfree(x) \
|
||||||
{ \
|
do { \
|
||||||
if (x) { \
|
if (x) { \
|
||||||
free((void *)(x)); \
|
free((void *)(x)); \
|
||||||
x = 0; \
|
x = 0; \
|
||||||
} \
|
} \
|
||||||
}
|
} while(0);
|
||||||
|
|
||||||
#define tstrncpy(dst, src, size) \
|
#define tstrncpy(dst, src, size) \
|
||||||
do { \
|
do { \
|
||||||
|
|
Loading…
Reference in New Issue