1
+ # SPDX-License-Identifier: LGPL-2.1-or-later
2
+
3
+ ##########################################################################
4
+
5
+ cmake_minimum_required (VERSION 2.8)
6
+
7
+ ##########################################################################
8
+
9
+ project (test -ArduinoCore-API)
10
+
11
+ ##########################################################################
12
+
13
+ include_directories (..)
14
+ include_directories (include )
15
+ include_directories (external/catch/v2.13.9/include )
16
+
17
+ ##########################################################################
18
+
19
+ set (CMAKE_CXX_STANDARD 11)
20
+
21
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin)
22
+
23
+ ##########################################################################
24
+
25
+ set (TEST_TARGET ${CMAKE_PROJECT_NAME} )
26
+
27
+ ##########################################################################
28
+
29
+ set (TEST_SRCS
30
+ src/CanMsg/test_CanMsg.cpp
31
+ src/CanMsg/test_CanMsg_CopyCtor.cpp
32
+ src/CanMsg/test_CanExtendedId.cpp
33
+ src/CanMsg/test_CanStandardId.cpp
34
+ src/CanMsg/test_isExtendedId.cpp
35
+ src/CanMsg/test_isStandardId.cpp
36
+ src/CanMsg/test_operator_assignment.cpp
37
+ src/CanMsg/test_printTo.cpp
38
+ src/CanMsgRingbuffer/test_available.cpp
39
+ src/Common/test_makeWord.cpp
40
+ src/Common/test_map.cpp
41
+ src/Common/test_max.cpp
42
+ src/Common/test_min.cpp
43
+ src/IPAddress/test_toString.cpp
44
+ src/IPAddress/test_fromString.cpp
45
+ src/IPAddress/test_fromString6.cpp
46
+ src/IPAddress/test_IPAddress.cpp
47
+ src/IPAddress/test_IPAddress6.cpp
48
+ src/IPAddress/test_operator_assignment.cpp
49
+ src/IPAddress/test_operator_comparison.cpp
50
+ src/IPAddress/test_operator_comparison6.cpp
51
+ src/IPAddress/test_operator_parentheses.cpp
52
+ src/IPAddress/test_operator_parentheses6.cpp
53
+ src/IPAddress/test_printTo.cpp
54
+ src/IPAddress/test_printTo6.cpp
55
+ src/Print/test_clearWriteError.cpp
56
+ src/Print/test_getWriteError.cpp
57
+ src/Print/test_print.cpp
58
+ src/Print/test_println.cpp
59
+ src/Print/test_availableForWrite.cpp
60
+ src/Ringbuffer/test_available.cpp
61
+ src/Ringbuffer/test_availableForStore.cpp
62
+ src/Ringbuffer/test_clear.cpp
63
+ src/Ringbuffer/test_isFull.cpp
64
+ src/Ringbuffer/test_peek.cpp
65
+ src/Ringbuffer/test_read_char.cpp
66
+ src/Ringbuffer/test_store_char.cpp
67
+ src/Stream/test_find.cpp
68
+ src/Stream/test_findUntil.cpp
69
+ src/Stream/test_getTimeout.cpp
70
+ src/Stream/test_parseFloat.cpp
71
+ src/Stream/test_parseInt.cpp
72
+ src/Stream/test_readBytes.cpp
73
+ src/Stream/test_readBytesUntil.cpp
74
+ src/Stream/test_readString.cpp
75
+ src/Stream/test_readStringUntil.cpp
76
+ src/Stream/test_setTimeout.cpp
77
+ src/String /test_concat.cpp
78
+ src/String /test_operators.cpp
79
+ src/String /test_compareTo.cpp
80
+ src/String /test_comparisonFunc.cpp
81
+ src/String /test_characterAccessFunc.cpp
82
+ src/String /test_substring.cpp
83
+ src/String /test_indexOf.cpp
84
+ src/String /test_lastIndexOf.cpp
85
+ src/String /test_length.cpp
86
+ src/String /test_move.cpp
87
+ src/String /test_remove.cpp
88
+ src/String /test_replace.cpp
89
+ src/String /test_String.cpp
90
+ src/String /test_toDouble.cpp
91
+ src/String /test_toFloat.cpp
92
+ src/String /test_toInt.cpp
93
+ src/String /test_toLowerCase.cpp
94
+ src/String /test_toUpperCase.cpp
95
+ src/String /test_trim.cpp
96
+ src/WCharacter/test_isAscii.cpp
97
+ src/WCharacter/test_isControl.cpp
98
+ src/WCharacter/test_isDigit.cpp
99
+ src/WCharacter/test_isHexadecimalDigit.cpp
100
+ src/WCharacter/test_isLowerCase.cpp
101
+ src/WCharacter/test_isPunct.cpp
102
+ src/WCharacter/test_isSpace.cpp
103
+ src/WCharacter/test_isUpperCase.cpp
104
+ src/WCharacter/test_isWhitespace.cpp
105
+ src/WCharacter/test_toAscii.cpp
106
+ )
107
+
108
+ set (TEST_DUT_SRCS
109
+ ../api/CanMsg.cpp
110
+ ../api/CanMsgRingbuffer.cpp
111
+ ../api/Common.cpp
112
+ ../api/IPAddress.cpp
113
+ ../api/String .cpp
114
+ ../api/Stream.cpp
115
+ ../api/Print.cpp
116
+ )
117
+
118
+ ##########################################################################
119
+
120
+ set (TEST_TARGET_SRCS
121
+ src/main.cpp
122
+ src/dtostrf.cpp
123
+ src/itoa.cpp
124
+ src/MillisFake.cpp
125
+ src/PrintMock.cpp
126
+ src/StreamMock.cpp
127
+ ${TEST_SRCS}
128
+ ${TEST_DUT_SRCS}
129
+ )
130
+
131
+ ##########################################################################
132
+
133
+ add_compile_definitions (HOST)
134
+ add_compile_options (-Wall -Wextra -Wpedantic -Werror)
135
+ add_compile_options (-Wno-cast-function-type )
136
+
137
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" )
138
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -Wno-deprecated-copy" )
139
+
140
+ ##########################################################################
141
+
142
+ add_executable (
143
+ ${TEST_TARGET}
144
+ ${TEST_TARGET_SRCS}
145
+ )
146
+
147
+ ##########################################################################
0 commit comments