From 172f11cad4925a667242edcb78d5fd06a3ddfc23 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 24 Dec 2020 14:01:42 +0800 Subject: [PATCH] [TD-225] update test cases. --- src/query/inc/qHistogram.h | 2 +- src/query/src/qHistogram.c | 1 - src/query/tests/histogramTest.cpp | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/query/inc/qHistogram.h b/src/query/inc/qHistogram.h index c904d0ec9b..7742d151a0 100644 --- a/src/query/inc/qHistogram.h +++ b/src/query/inc/qHistogram.h @@ -67,7 +67,7 @@ void tHistogramDestroy(SHistogramInfo** pHisto); void tHistogramPrint(SHistogramInfo* pHisto); -//int32_t histoBinarySearch(SHistBin* pEntry, int32_t len, double val); +int32_t histoBinarySearch(SHistBin* pEntry, int32_t len, double val); SHeapEntry* tHeapCreate(int32_t numOfEntries); void tHeapSort(SHeapEntry* pEntry, int32_t len); diff --git a/src/query/src/qHistogram.c b/src/query/src/qHistogram.c index bd979f1244..6ae6ede972 100644 --- a/src/query/src/qHistogram.c +++ b/src/query/src/qHistogram.c @@ -120,7 +120,6 @@ //} static int32_t histogramCreateBin(SHistogramInfo* pHisto, int32_t index, double val); -static int32_t histoBinarySearch(SHistBin* pEntry, int32_t len, double val); SHistogramInfo* tHistogramCreate(int32_t numOfEntries) { /* need one redundant slot */ diff --git a/src/query/tests/histogramTest.cpp b/src/query/tests/histogramTest.cpp index 4a5f7fbbbe..82fd4bcf99 100644 --- a/src/query/tests/histogramTest.cpp +++ b/src/query/tests/histogramTest.cpp @@ -21,19 +21,19 @@ TEST(testCase, histogram_binary_search) { pHisto->elems[i].val = i; } - int32_t idx = vnodeHistobinarySearch(pHisto->elems, pHisto->numOfEntries, 1); + int32_t idx = histoBinarySearch(pHisto->elems, pHisto->numOfEntries, 1); assert(idx == 1); - idx = vnodeHistobinarySearch(pHisto->elems, pHisto->numOfEntries, 9); + idx = histoBinarySearch(pHisto->elems, pHisto->numOfEntries, 9); assert(idx == 9); - idx = vnodeHistobinarySearch(pHisto->elems, pHisto->numOfEntries, 20); + idx = histoBinarySearch(pHisto->elems, pHisto->numOfEntries, 20); assert(idx == 10); - idx = vnodeHistobinarySearch(pHisto->elems, pHisto->numOfEntries, -1); + idx = histoBinarySearch(pHisto->elems, pHisto->numOfEntries, -1); assert(idx == 0); - idx = vnodeHistobinarySearch(pHisto->elems, pHisto->numOfEntries, 3.9); + idx = histoBinarySearch(pHisto->elems, pHisto->numOfEntries, 3.9); assert(idx == 4); free(pHisto); -- GitLab