🧪 test(mq test case): add test case

This commit is contained in:
yangwei
2024-09-13 19:04:59 +08:00
parent c3edc5d1ce
commit 364f8c84a3
5 changed files with 1640 additions and 3 deletions

View File

@@ -1,3 +1,3 @@
add_library(mq mq.c)
#add_subdirectory(test)
add_subdirectory(test)

View File

@@ -1,4 +1,4 @@
#include "mq_interna.h"
#include "mq_internal.h"
#include "stellar/utils.h"
#include "uthash/utlist.h"
@@ -226,6 +226,10 @@ void mq_schema_free(struct mq_schema *s)
if(s==NULL)return;
if(s->topic_array)
{
for (unsigned int i = 0; i < utarray_len(s->topic_array); i++)
{
mq_schema_destroy_topic(s, i);
}
utarray_free(s->topic_array);
}
FREE(s);
@@ -234,7 +238,7 @@ void mq_schema_free(struct mq_schema *s)
struct mq_runtime *mq_runtime_new(struct mq_schema *s)
{
if(s==NULL || s->topic_array==NULL)return NULL;
if(s==NULL)return NULL;
struct mq_runtime *rt = CALLOC(struct mq_runtime,1);
rt->schema=s;
return rt;

View File

@@ -0,0 +1,14 @@
add_executable(gtest_mq gtest_mq_main.cpp)
target_include_directories(gtest_mq PRIVATE ${CMAKE_SOURCE_DIR}/infra/)
target_link_libraries(
gtest_mq
mq
"-rdynamic"
gtest
gmock
)
include(GoogleTest)
gtest_discover_tests(gtest_mq)

File diff suppressed because it is too large Load Diff