summaryrefslogtreecommitdiff
path: root/auto_tests/monolith_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/monolith_test.cpp')
-rw-r--r--auto_tests/monolith_test.cpp293
1 files changed, 0 insertions, 293 deletions
diff --git a/auto_tests/monolith_test.cpp b/auto_tests/monolith_test.cpp
deleted file mode 100644
index 44a5b16b..00000000
--- a/auto_tests/monolith_test.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
1/* Nop-test, just to make sure our code compiles as C++.
2 */
3
4#ifdef __FreeBSD__
5// Include this here, because _XOPEN_SOURCE hides symbols we need.
6//
7// https://lists.freebsd.org/pipermail/freebsd-standards/2004-March/000474.html.
8#include <net/if.h>
9#endif
10
11#ifdef __APPLE__
12#define _DARWIN_C_SOURCE
13#endif
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include "../other/monolith.h"
20#define DHT_C_INCLUDED
21
22#include "check_compat.h"
23#include "helpers.h"
24#include "../testing/misc_tools.c"
25
26#include <ctype.h>
27
28namespace TCP_test
29{
30int main(void);
31#include "TCP_test.c"
32}
33namespace bootstrap_test
34{
35int main(void);
36#include "bootstrap_test.c"
37}
38namespace conference_test
39{
40int main(void);
41#include "conference_test.c"
42}
43namespace crypto_test
44{
45int main(void);
46#include "crypto_test.c"
47}
48namespace dht_test
49{
50int main(void);
51#include "dht_test.c"
52}
53namespace encryptsave_test
54{
55int main(void);
56#include "encryptsave_test.c"
57}
58namespace file_saving_test
59{
60int main(void);
61#include "file_saving_test.c"
62}
63namespace friend_request_test
64{
65int main(void);
66#include "friend_request_test.c"
67}
68namespace lan_discovery_test
69{
70int main(void);
71#include "lan_discovery_test.c"
72}
73namespace lossless_packet_test
74{
75int main(void);
76#include "lossless_packet_test.c"
77}
78namespace lossy_packet_test
79{
80int main(void);
81#include "lossy_packet_test.c"
82}
83namespace messenger_test
84{
85int main(void);
86#include "messenger_test.c"
87}
88namespace network_test
89{
90int main(void);
91#include "network_test.c"
92}
93namespace onion_test
94{
95int main(void);
96#include "onion_test.c"
97}
98namespace save_friend_test
99{
100int main(void);
101#include "save_friend_test.c"
102}
103namespace save_load_test
104{
105int main(void);
106#include "save_load_test.c"
107}
108namespace selfname_change_conference_test
109{
110int main(void);
111#include "selfname_change_conference_test.c"
112}
113namespace self_conference_title_change_test
114{
115int main(void);
116#include "self_conference_title_change_test.c"
117}
118namespace send_message_test
119{
120int main(void);
121#include "send_message_test.c"
122}
123namespace set_name_test
124{
125int main(void);
126#include "set_name_test.c"
127}
128namespace set_status_message_test
129{
130int main(void);
131#include "set_status_message_test.c"
132}
133namespace simple_conference_test
134{
135int main(void);
136#include "simple_conference_test.c"
137}
138namespace skeleton_test
139{
140int main(void);
141#include "skeleton_test.c"
142}
143namespace toxav_basic_test
144{
145int main(void);
146#include "toxav_basic_test.c"
147}
148namespace toxav_many_test
149{
150int main(void);
151#include "toxav_many_test.c"
152}
153namespace tox_many_tcp_test
154{
155int main(void);
156#include "tox_many_tcp_test.c"
157}
158namespace tox_many_test
159{
160int main(void);
161#include "tox_many_test.c"
162}
163namespace tox_one_test
164{
165int main(void);
166#include "tox_one_test.c"
167}
168namespace tox_strncasecmp_test
169{
170int main(void);
171#include "tox_strncasecmp_test.c"
172}
173namespace typing_test
174{
175int main(void);
176#include "typing_test.c"
177}
178namespace version_test
179{
180int main(void);
181#include "version_test.c"
182}
183
184#define PRINT_SIZE 0
185
186template<typename T, size_t Expected, size_t Actual = sizeof(T)>
187void check_size(char const *type)
188{
189#if PRINT_SIZE
190 printf("CHECK_SIZE(%s, %zu);\n", type, Actual);
191#else
192 static_assert(Actual == Expected, "Bad sizeof - see template expansion errors for details");
193#endif
194}
195
196#define CHECK_SIZE(TYPE, SIZE) check_size<TYPE, SIZE>(#TYPE)
197
198/**
199 * The main function static-asserts that we are aware of all the sizes of all
200 * the structs it toxcore. If you find this failing after you make a change,
201 * switch on the PRINT_SIZE above and copy the number into this function.
202 */
203int main(int argc, char *argv[])
204{
205#if defined(__x86_64__) && defined(__LP64__)
206 // toxcore/DHT
207 CHECK_SIZE(Client_data, 496);
208 CHECK_SIZE(Cryptopacket_Handles, 16);
209 CHECK_SIZE(DHT, 676528);
210 CHECK_SIZE(DHT_Friend, 5104);
211 CHECK_SIZE(Hardening, 144);
212 CHECK_SIZE(IPPTs, 40);
213 CHECK_SIZE(IPPTsPng, 232);
214 CHECK_SIZE(NAT, 48);
215 CHECK_SIZE(Node_format, 64);
216 CHECK_SIZE(Shared_Key, 80);
217 CHECK_SIZE(Shared_Keys, 81920);
218 // toxcore/friend_connection
219 CHECK_SIZE(Friend_Conn, 1784);
220 CHECK_SIZE(Friend_Connections, 72);
221 // toxcore/friend_requests
222 CHECK_SIZE(Friend_Requests, 1080);
223 // toxcore/group
224 CHECK_SIZE(Group_c, 728);
225 CHECK_SIZE(Group_Chats, 2120);
226 CHECK_SIZE(Group_Peer, 480);
227 // toxcore/list
228 CHECK_SIZE(BS_LIST, 32);
229 // toxcore/logger
230 CHECK_SIZE(Logger, 24);
231 // toxcore/Messenger
232 CHECK_SIZE(File_Transfers, 72);
233 CHECK_SIZE(Friend, 39264);
234 CHECK_SIZE(Messenger, 2008);
235 CHECK_SIZE(Messenger_Options, 72);
236 CHECK_SIZE(Receipts, 16);
237 // toxcore/net_crypto
238#ifdef __linux__
239 CHECK_SIZE(Crypto_Connection, 525392);
240 CHECK_SIZE(Net_Crypto, 272);
241#endif
242 CHECK_SIZE(New_Connection, 168);
243 CHECK_SIZE(Packet_Data, 1384);
244 CHECK_SIZE(Packets_Array, 262152);
245 // toxcore/network
246 CHECK_SIZE(IP, 24);
247 CHECK_SIZE(IP4, 4);
248#if USE_IPV6
249 CHECK_SIZE(IP6, 16);
250#endif
251 CHECK_SIZE(IP_Port, 32);
252 CHECK_SIZE(Networking_Core, 4112);
253 CHECK_SIZE(Packet_Handler, 16);
254 // toxcore/onion_announce
255 CHECK_SIZE(Cmp_data, 296);
256 CHECK_SIZE(Onion_Announce, 128048);
257 CHECK_SIZE(Onion_Announce_Entry, 288);
258 // toxcore/onion_client
259 CHECK_SIZE(Last_Pinged, 40);
260 CHECK_SIZE(Onion_Client, 15816);
261 CHECK_SIZE(Onion_Client_Cmp_data, 176);
262 CHECK_SIZE(Onion_Client_Paths, 2520);
263 CHECK_SIZE(Onion_Friend, 1936);
264 CHECK_SIZE(Onion_Friend, 1936);
265 CHECK_SIZE(Onion_Node, 168);
266 // toxcore/onion
267 CHECK_SIZE(Onion, 245832);
268 CHECK_SIZE(Onion_Path, 392);
269 // toxcore/ping_array
270 CHECK_SIZE(Ping_Array, 24);
271 CHECK_SIZE(Ping_Array_Entry, 32);
272 // toxcore/ping
273 CHECK_SIZE(Ping, 2072);
274 // toxcore/TCP_client
275 CHECK_SIZE(TCP_Client_Connection, 12064);
276 CHECK_SIZE(TCP_Proxy_Info, 40);
277 // toxcore/TCP_connection
278 CHECK_SIZE(TCP_con, 112);
279 CHECK_SIZE(TCP_Connections, 200);
280 CHECK_SIZE(TCP_Connection_to, 112);
281 // toxcore/TCP_server
282 CHECK_SIZE(TCP_Priority_List, 16);
283 CHECK_SIZE(TCP_Secure_Connection, 11816);
284#ifdef TCP_SERVER_USE_EPOLL
285 CHECK_SIZE(TCP_Server, 6049968); // 6MB!
286#else
287 CHECK_SIZE(TCP_Server, 6049952); // 6MB!
288#endif
289 // toxcore/tox
290 CHECK_SIZE(Tox_Options, 64);
291#endif
292 return 0;
293}