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_IPv6_Utils" )
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_ICMP.h"
20            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_Sockets.h"
21            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Utils.h"
22        )
23
24set(mock_include_list "")
25# list the directories your mocks need
26list(APPEND mock_include_list
27            .
28            ${TCP_INCLUDE_DIRS}
29            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
30            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
31            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
32            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
33        )
34
35set(mock_define_list "")
36#list the definitions of your mocks to control what to be included
37list(APPEND mock_define_list
38            ""
39       )
40
41# ================= Create the library under test here (edit) ==================
42
43set(real_source_files "")
44
45# list the files you would like to test here
46list(APPEND real_source_files
47            ${CMAKE_BINARY_DIR}/Annexed_TCP_Sources/${project_name}.c
48	)
49
50set(real_include_directories "")
51# list the directories the module under test includes
52list(APPEND real_include_directories
53            .
54            ${TCP_INCLUDE_DIRS}
55            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
56            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
57            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
58            ${CMOCK_DIR}/vendor/unity/src
59            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
60	)
61
62# =====================  Create UnitTest Code here (edit)  =====================
63set(test_include_directories "")
64# list the directories your test needs to include
65list(APPEND test_include_directories
66            .
67            ${CMOCK_DIR}/vendor/unity/src
68            ${TCP_INCLUDE_DIRS}
69            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
70            ${CMAKE_BINARY_DIR}/Annexed_TCP_Sources
71        )
72
73# =============================  (end edit)  ===================================
74
75set(mock_name "${project_name}_mock")
76set(real_name "${project_name}_real")
77
78create_mock_list(${mock_name}
79                "${mock_list}"
80                "${MODULE_ROOT_DIR}/test/unit-test/cmock/project.yml"
81                "${mock_include_list}"
82                "${mock_define_list}"
83        )
84
85create_real_library(${real_name}
86                    "${real_source_files}"
87                    "${real_include_directories}"
88                    "${mock_name}"
89        )
90
91set( utest_link_list "" )
92list(APPEND utest_link_list
93            -l${mock_name}
94            lib${real_name}.a
95        )
96
97set( utest_dep_list "" )
98list(APPEND utest_dep_list
99            ${real_name}
100        )
101
102set(utest_name "${project_name}_utest")
103set(utest_source "${project_name}/${project_name}_utest.c")
104
105create_test(${utest_name}
106            ${utest_source}
107            "${utest_link_list}"
108            "${utest_dep_list}"
109            "${test_include_directories}"
110        )
111