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_Sockets_DiffConfig1" )
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/portable.h"
18            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP.h"
19            "${MODULE_ROOT_DIR}/test/unit-test/${project_name}/Sockets_DiffConfig1_list_macros.h"
20        )
21
22set(mock_include_list "")
23# list the directories your mocks need
24list(APPEND mock_include_list
25            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
26            .
27            ${TCP_INCLUDE_DIRS}
28            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
29            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
30            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
31        )
32
33set(mock_define_list "")
34#list the definitions of your mocks to control what to be included
35list(APPEND mock_define_list
36            ""
37       )
38
39# ================= Create the library under test here (edit) ==================
40
41set(real_source_files "")
42
43# list the files you would like to test here
44list(APPEND real_source_files
45            ${CMAKE_BINARY_DIR}/Annexed_TCP_Sources/FreeRTOS_Sockets.c
46	)
47
48set(real_include_directories "")
49# list the directories the module under test includes
50list(APPEND real_include_directories
51            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
52            .
53            ${TCP_INCLUDE_DIRS}
54            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
55            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
56            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
57            ${CMOCK_DIR}/vendor/unity/src
58            ${MODULE_ROOT_DIR}/test/unit-test/FreeRTOS_Sockets
59	)
60
61# =====================  Create UnitTest Code here (edit)  =====================
62set(test_include_directories "")
63# list the directories your test needs to include
64list(APPEND test_include_directories
65            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
66            .
67            ${CMOCK_DIR}/vendor/unity/src
68            ${TCP_INCLUDE_DIRS}
69            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
70            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
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
97list(APPEND utest_dep_list
98            ${real_name}
99        )
100
101set(utest_name "${project_name}_privates_utest")
102set(utest_source "${project_name}/${project_name}_privates_utest.c" )
103
104create_test(${utest_name}
105            ${utest_source}
106            "${utest_link_list}"
107            "${utest_dep_list}"
108            "${test_include_directories}"
109        )
110
111set(utest_name "${project_name}_GenericAPI_utest")
112set(utest_source "${project_name}/${project_name}_GenericAPI_utest.c" )
113
114create_test(${utest_name}
115            ${utest_source}
116            "${utest_link_list}"
117            "${utest_dep_list}"
118            "${test_include_directories}"
119        )
120