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