1# Include filepaths for source and include.
2include( ${MODULE_ROOT_DIR}/test/unit-test/TCPFilePaths.cmake )
3
4# ====================  Define your project name (edit) ========================
5set( project_name "FreeRTOS_Routing" )
6message( STATUS "${project_name}" )
7
8# =====================  Create your mock here  (edit)  ========================
9set(mock_list "")
10
11# list the files to mock here
12list(APPEND mock_list
13            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/task.h"
14            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/list.h"
15            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/queue.h"
16            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/event_groups.h"
17            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP.h"
18            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IPv6.h"
19            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_Sockets.h"
20            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Private.h"
21            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_ARP.h"
22            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_UDP_IP.h"
23            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_DHCP.h"
24            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_DNS.h"
25            "${CMAKE_BINARY_DIR}/Annexed_TCP/NetworkBufferManagement.h"
26        )
27
28set(mock_include_list "")
29# list the directories your mocks need
30list(APPEND mock_include_list
31            .
32            ${TCP_INCLUDE_DIRS}
33            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
34            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
35            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
36            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
37        )
38
39set(mock_define_list "")
40#list the definitions of your mocks to control what to be included
41list(APPEND mock_define_list
42            ""
43       )
44
45# ================= Create the library under test here (edit) ==================
46
47set(real_source_files "")
48
49# list the files you would like to test here
50list(APPEND real_source_files
51            ${CMAKE_BINARY_DIR}/Annexed_TCP_Sources/${project_name}.c
52	)
53
54set(real_include_directories "")
55# list the directories the module under test includes
56list(APPEND real_include_directories
57            .
58            ${TCP_INCLUDE_DIRS}
59            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
60            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
61            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
62            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
63            ${CMOCK_DIR}/vendor/unity/src
64	)
65
66# =====================  Create UnitTest Code here (edit)  =====================
67set(test_include_directories "")
68# list the directories your test needs to include
69list(APPEND test_include_directories
70            .
71            ${CMOCK_DIR}/vendor/unity/src
72            ${TCP_INCLUDE_DIRS}
73            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
74            ${CMAKE_BINARY_DIR}/Annexed_TCP_Sources
75        )
76
77# =============================  (end edit)  ===================================
78
79set(mock_name "${project_name}_mock")
80set(real_name "${project_name}_real")
81
82create_mock_list(${mock_name}
83                "${mock_list}"
84                "${MODULE_ROOT_DIR}/test/unit-test/cmock/project.yml"
85                "${mock_include_list}"
86                "${mock_define_list}"
87        )
88
89create_real_library(${real_name}
90                    "${real_source_files}"
91                    "${real_include_directories}"
92                    "${mock_name}"
93        )
94
95set( utest_link_list "" )
96list(APPEND utest_link_list
97            -l${mock_name}
98            lib${real_name}.a
99        )
100
101set( utest_dep_list "" )
102list(APPEND utest_dep_list
103            ${real_name}
104        )
105
106set(utest_name "${project_name}_utest")
107set(utest_source "${project_name}/${project_name}_utest.c")
108
109create_test(${utest_name}
110            ${utest_source}
111            "${utest_link_list}"
112            "${utest_dep_list}"
113            "${test_include_directories}"
114        )