From c99c119b2f3419cc8ff3bf01136edf1d089e76b3 Mon Sep 17 00:00:00 2001 From: huangxin Date: Wed, 1 Feb 2023 10:10:49 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=20=E9=87=8D=E6=96=B0=E6=95=B4=E7=90=86?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E7=9B=AE=E5=BD=95=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 5 +++++ srcs/libs/CMakeLists.txt | 4 ---- srcs/libs/unit_test/CMakeLists.txt | 2 +- srcs/libs/unit_test/misc/uuid_test.cpp | 2 +- test/CMakeLists.txt | 3 +++ {srcs/libs/unit_test => test}/doctest.h | 0 6 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 test/CMakeLists.txt rename {srcs/libs/unit_test => test}/doctest.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04a3ce0..72001e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,3 +111,8 @@ ENDIF () ADD_SUBDIRECTORY(srcs) ADD_SUBDIRECTORY(srcs/libs) ADD_SUBDIRECTORY(srcs/httpserver) + +IF (BUILD_TESTING) + ADD_SUBDIRECTORY(test) + ADD_SUBDIRECTORY(srcs/libs/unit_test) +ENDIF () diff --git a/srcs/libs/CMakeLists.txt b/srcs/libs/CMakeLists.txt index 5bb4284..a19ed4c 100644 --- a/srcs/libs/CMakeLists.txt +++ b/srcs/libs/CMakeLists.txt @@ -61,7 +61,3 @@ IF (USED_OPENDHCPD) ENDIF () TARGET_INCLUDE_DIRECTORIES(${LIB_PROJECT_TARGET} PUBLIC ${PROJECT_BINARY_DIR}/ ${CMAKE_BINARY_DIR}/) - -IF (BUILD_TESTING) - ADD_SUBDIRECTORY(unit_test) -ENDIF () \ No newline at end of file diff --git a/srcs/libs/unit_test/CMakeLists.txt b/srcs/libs/unit_test/CMakeLists.txt index 839716b..7907a5a 100644 --- a/srcs/libs/unit_test/CMakeLists.txt +++ b/srcs/libs/unit_test/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(libcommon_utest) -INCLUDE_DIRECTORIES(./ ../include ../../include) +INCLUDE_DIRECTORIES(./ ../include ../../include ../../test) AUX_SOURCE_DIRECTORY(misc UTEST_SRC) diff --git a/srcs/libs/unit_test/misc/uuid_test.cpp b/srcs/libs/unit_test/misc/uuid_test.cpp index 259f49b..b8c4959 100644 --- a/srcs/libs/unit_test/misc/uuid_test.cpp +++ b/srcs/libs/unit_test/misc/uuid_test.cpp @@ -3,7 +3,7 @@ // // provides main(); this line is required in only one .cpp file #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include "../doctest.h" +#include "doctest.h" #include "uuid.h" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..bf8f0f8 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,3 @@ +PROJECT(vcpe_utest) + +INCLUDE_DIRECTORIES(./ ../srcs/include ../srcs/libs/include) diff --git a/srcs/libs/unit_test/doctest.h b/test/doctest.h similarity index 100% rename from srcs/libs/unit_test/doctest.h rename to test/doctest.h