case: add arrayTest unit case

This commit is contained in:
Alex Duan 2023-12-08 18:27:38 +08:00
parent 8472a0f2e2
commit 7adad817c9
3 changed files with 32 additions and 6 deletions

View File

@ -33,6 +33,14 @@ ENDIF()
INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc)
# arrayTest
add_executable(arrayTest "arrayTest.cpp")
target_link_libraries(arrayTest os util gtest_main)
add_test(
NAME arrayTest
COMMAND arrayTest
)
# # freelistTest
# add_executable(freelistTest "")
# target_sources(freelistTest

View File

@ -82,3 +82,21 @@ TEST(arrayTest, array_search_test) {
taosArrayDestroy(pa);
}
TEST(arrayTest, array_data_correct) {
SArray* pa = (SArray*)taosArrayInit(1, sizeof(int32_t));
size_t cnt = 1000;
for (int32_t i = 0; i < cnt; ++i) {
taosArrayPush(pa, &i);
}
ASSERT_EQ(taosArrayGetSize(pa), cnt);
int32_t* pv = NULL;
for (int32_t i = 0; i < cnt; i++) {
pv = (int32_t*)taosArrayGet(pa, i);
ASSERT_EQ(*pv, i);
}
taosArrayDestroy(pa);
}

View File

@ -26,12 +26,12 @@ import threading
import importlib
import toml
sys.path.append("../pytest")
from util.log import *
from util.dnodes import *
from util.cases import *
from util.cluster import *
from util.taosadapter import *
from frame.log import *
from frame.dnodes import *
from frame.cases import *
from frame.cluster import *
from frame.taosadapter import *
import taos
import taosrest