From d8d60215625a983511fc147f28550fb6e9278084 Mon Sep 17 00:00:00 2001
From: armatusmiles <akurotych@gmail.com>
Date: Wed, 19 Sep 2018 00:30:35 +0300
Subject: [PATCH] [+] libdap-test module

---
 .gitmodules         |  3 +++
 CMakeLists.txt      |  5 +++++
 test/CMakeLists.txt | 18 ++++++++++++++++++
 test/libdap-test    |  1 +
 test/main.c         |  5 +++++
 5 files changed, 32 insertions(+)
 create mode 100644 test/CMakeLists.txt
 create mode 160000 test/libdap-test
 create mode 100644 test/main.c

diff --git a/.gitmodules b/.gitmodules
index 739b715..3a5e93f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
 [submodule "libdap-server-core"]
 	path = libdap-server-core
 	url = https://github.com/kelvinblockchain/libdap-server-core.git
+[submodule "test/libdap-test"]
+	path = test/libdap-test
+	url = https://github.com/kelvinblockchain/libdap-test.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3556eef..a026a44 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,11 @@ project (dap_udp_server C)
 
 add_subdirectory(libdap-server-core)
 
+if(BUILD_DAP_UDP_SERVER_TESTS)
+    enable_testing()
+    add_subdirectory(test)
+endif()
+
 set(DAP_UDP_SERVER_SRCS dap_udp_server.c dap_udp_client.h dap_udp_client.c)
 
 add_library(${PROJECT_NAME} STATIC ${DAP_UDP_SERVER_SRCS})
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..ef2ee70
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.0)
+project(udp-server-test)
+
+set(CMAKE_C_STANDARD 11)
+
+add_subdirectory(libdap-test)
+
+file(GLOB SRC *.h *.c)
+
+add_executable(${PROJECT_NAME} ${SRC})
+
+target_link_libraries(${PROJECT_NAME} dap_test)
+
+add_test(
+    NAME udp-server-test
+    COMMAND udp-server-test
+)
+
diff --git a/test/libdap-test b/test/libdap-test
new file mode 160000
index 0000000..e542fdb
--- /dev/null
+++ b/test/libdap-test
@@ -0,0 +1 @@
+Subproject commit e542fdbcbced6ce9b1c4cae4a92fa8580403941e
diff --git a/test/main.c b/test/main.c
new file mode 100644
index 0000000..e02c1ef
--- /dev/null
+++ b/test/main.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+int main()
+{
+    return 0;
+}
-- 
GitLab