未验证 提交 f3eb9c06 编写于 作者: H Hongze Cheng 提交者: GitHub

Merge pull request #17671 from taosdata/fix/remove-batcharraytest

fix: remove tarray's batch remove test
...@@ -5,52 +5,52 @@ ...@@ -5,52 +5,52 @@
#include "tarray.h" #include "tarray.h"
#include "tcompare.h" #include "tcompare.h"
/*
namespace { namespace {
static void remove_batch_test() { static void remove_batch_test() {
SArray* pa = (SArray*)taosArrayInit(4, sizeof(int32_t)); SArray* pa = (SArray*)taosArrayInit(4, sizeof(int32_t));
for (int32_t i = 0; i < 20; ++i) { for (int32_t i = 0; i < 20; ++i) {
int32_t a = i; int32_t a = i;
taosArrayPush(pa, &a); taosArrayPush(pa, &a);
} }
SArray* delList = (SArray*)taosArrayInit(4, sizeof(int32_t)); SArray* delList = (SArray*)taosArrayInit(4, sizeof(int32_t));
taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList)); taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList));
EXPECT_EQ(taosArrayGetSize(pa), 20); EXPECT_EQ(taosArrayGetSize(pa), 20);
int32_t a = 5; int32_t a = 5;
taosArrayPush(delList, &a); taosArrayPush(delList, &a);
taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList)); taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList));
EXPECT_EQ(taosArrayGetSize(pa), 19); EXPECT_EQ(taosArrayGetSize(pa), 19);
EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 6); EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 6);
taosArrayInsert(pa, 5, &a); taosArrayInsert(pa, 5, &a);
EXPECT_EQ(taosArrayGetSize(pa), 20); EXPECT_EQ(taosArrayGetSize(pa), 20);
EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 5); EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 5);
taosArrayClear(delList); taosArrayClear(delList);
a = 6; a = 6;
taosArrayPush(delList, &a); taosArrayPush(delList, &a);
a = 9; a = 9;
taosArrayPush(delList, &a); taosArrayPush(delList, &a);
a = 14; a = 14;
taosArrayPush(delList, &a); taosArrayPush(delList, &a);
taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList)); taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList));
EXPECT_EQ(taosArrayGetSize(pa), 17); EXPECT_EQ(taosArrayGetSize(pa), 17);
taosArrayDestroy(pa); taosArrayDestroy(pa);
taosArrayDestroy(delList); taosArrayDestroy(delList);
} }
} // namespace } // namespace
TEST(arrayTest, array_list_test) { remove_batch_test(); } TEST(arrayTest, array_list_test) { remove_batch_test(); }
*/
TEST(arrayTest, array_search_test) { TEST(arrayTest, array_search_test) {
SArray* pa = (SArray*)taosArrayInit(4, sizeof(int32_t)); SArray* pa = (SArray*)taosArrayInit(4, sizeof(int32_t));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册