🧪 test(mq test case): add test case
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
add_library(mq mq.c)
|
add_library(mq mq.c)
|
||||||
|
|
||||||
#add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "mq_interna.h"
|
#include "mq_internal.h"
|
||||||
#include "stellar/utils.h"
|
#include "stellar/utils.h"
|
||||||
#include "uthash/utlist.h"
|
#include "uthash/utlist.h"
|
||||||
|
|
||||||
@@ -226,6 +226,10 @@ void mq_schema_free(struct mq_schema *s)
|
|||||||
if(s==NULL)return;
|
if(s==NULL)return;
|
||||||
if(s->topic_array)
|
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);
|
utarray_free(s->topic_array);
|
||||||
}
|
}
|
||||||
FREE(s);
|
FREE(s);
|
||||||
@@ -234,7 +238,7 @@ void mq_schema_free(struct mq_schema *s)
|
|||||||
|
|
||||||
struct mq_runtime *mq_runtime_new(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);
|
struct mq_runtime *rt = CALLOC(struct mq_runtime,1);
|
||||||
rt->schema=s;
|
rt->schema=s;
|
||||||
return rt;
|
return rt;
|
||||||
|
|||||||
14
infra/mq/test/CMakeLists.txt
Normal file
14
infra/mq/test/CMakeLists.txt
Normal 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)
|
||||||
1619
infra/mq/test/gtest_mq_main.cpp
Normal file
1619
infra/mq/test/gtest_mq_main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user