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