diff options
Diffstat (limited to 'auto_tests/toxav_many_test.c')
-rw-r--r-- | auto_tests/toxav_many_test.c | 243 |
1 files changed, 129 insertions, 114 deletions
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index f9a24012..75aec9c7 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -32,7 +32,7 @@ typedef enum _CallStatus { | |||
32 | Ended, | 32 | Ended, |
33 | Rejected, | 33 | Rejected, |
34 | Cancel | 34 | Cancel |
35 | 35 | ||
36 | } CallStatus; | 36 | } CallStatus; |
37 | 37 | ||
38 | typedef struct _Party { | 38 | typedef struct _Party { |
@@ -43,7 +43,7 @@ typedef struct _Party { | |||
43 | 43 | ||
44 | typedef struct _ACall { | 44 | typedef struct _ACall { |
45 | pthread_t tid; | 45 | pthread_t tid; |
46 | 46 | ||
47 | Party Caller; | 47 | Party Caller; |
48 | Party Callee; | 48 | Party Callee; |
49 | } ACall; | 49 | } ACall; |
@@ -62,21 +62,22 @@ void accept_friend_request(Tox *m, uint8_t *public_key, uint8_t *data, uint16_t | |||
62 | 62 | ||
63 | /******************************************************************************/ | 63 | /******************************************************************************/ |
64 | void callback_recv_invite ( int32_t call_index, void *_arg ) | 64 | void callback_recv_invite ( int32_t call_index, void *_arg ) |
65 | {/* | 65 | { |
66 | Status *cast = _arg; | 66 | /* |
67 | 67 | Status *cast = _arg; | |
68 | cast->calls[call_index].Callee.status = Ringing;*/ | 68 | |
69 | cast->calls[call_index].Callee.status = Ringing;*/ | ||
69 | } | 70 | } |
70 | void callback_recv_ringing ( int32_t call_index, void *_arg ) | 71 | void callback_recv_ringing ( int32_t call_index, void *_arg ) |
71 | { | 72 | { |
72 | Status *cast = _arg; | 73 | Status *cast = _arg; |
73 | 74 | ||
74 | cast->calls[call_index].Caller.status = Ringing; | 75 | cast->calls[call_index].Caller.status = Ringing; |
75 | } | 76 | } |
76 | void callback_recv_starting ( int32_t call_index, void *_arg ) | 77 | void callback_recv_starting ( int32_t call_index, void *_arg ) |
77 | { | 78 | { |
78 | Status *cast = _arg; | 79 | Status *cast = _arg; |
79 | 80 | ||
80 | cast->calls[call_index].Caller.status = InCall; | 81 | cast->calls[call_index].Caller.status = InCall; |
81 | } | 82 | } |
82 | void callback_recv_ending ( int32_t call_index, void *_arg ) | 83 | void callback_recv_ending ( int32_t call_index, void *_arg ) |
@@ -92,28 +93,31 @@ void callback_recv_error ( int32_t call_index, void *_arg ) | |||
92 | } | 93 | } |
93 | 94 | ||
94 | void callback_call_started ( int32_t call_index, void *_arg ) | 95 | void callback_call_started ( int32_t call_index, void *_arg ) |
95 | {/* | 96 | { |
96 | Status *cast = _arg; | 97 | /* |
97 | 98 | Status *cast = _arg; | |
98 | cast->calls[call_index].Callee.status = InCall;*/ | 99 | |
100 | cast->calls[call_index].Callee.status = InCall;*/ | ||
99 | } | 101 | } |
100 | void callback_call_canceled ( int32_t call_index, void *_arg ) | 102 | void callback_call_canceled ( int32_t call_index, void *_arg ) |
101 | {/* | 103 | { |
102 | Status *cast = _arg; | 104 | /* |
103 | 105 | Status *cast = _arg; | |
104 | cast->calls[call_index].Callee.status = Cancel;*/ | 106 | |
107 | cast->calls[call_index].Callee.status = Cancel;*/ | ||
105 | } | 108 | } |
106 | void callback_call_rejected ( int32_t call_index, void *_arg ) | 109 | void callback_call_rejected ( int32_t call_index, void *_arg ) |
107 | { | 110 | { |
108 | Status *cast = _arg; | 111 | Status *cast = _arg; |
109 | 112 | ||
110 | cast->calls[call_index].Caller.status = Rejected; | 113 | cast->calls[call_index].Caller.status = Rejected; |
111 | } | 114 | } |
112 | void callback_call_ended ( int32_t call_index, void *_arg ) | 115 | void callback_call_ended ( int32_t call_index, void *_arg ) |
113 | {/* | 116 | { |
114 | Status *cast = _arg; | 117 | /* |
115 | 118 | Status *cast = _arg; | |
116 | cast->calls[call_index].Callee.status = Ended;*/ | 119 | |
120 | cast->calls[call_index].Callee.status = Ended;*/ | ||
117 | } | 121 | } |
118 | 122 | ||
119 | void callback_requ_timeout ( int32_t call_index, void *_arg ) | 123 | void callback_requ_timeout ( int32_t call_index, void *_arg ) |
@@ -123,104 +127,113 @@ void callback_requ_timeout ( int32_t call_index, void *_arg ) | |||
123 | /*************************************************************************************************/ | 127 | /*************************************************************************************************/ |
124 | 128 | ||
125 | 129 | ||
126 | void* in_thread_call (void* arg) | 130 | void *in_thread_call (void *arg) |
127 | { | 131 | { |
128 | #define call_print(call, what, args...) printf("[%d] " what "\n", call, ##args) | 132 | #define call_print(call, what, args...) printf("[%d] " what "\n", call, ##args) |
129 | 133 | ||
130 | ACall* this_call = arg; | 134 | ACall *this_call = arg; |
131 | uint64_t start = 0; | 135 | uint64_t start = 0; |
132 | int step = 0,running = 1; | 136 | int step = 0, running = 1; |
133 | int call_idx; | 137 | int call_idx; |
134 | 138 | ||
135 | const int frame_size = (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000); | 139 | const int frame_size = (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000); |
136 | int16_t sample_payload[frame_size]; | 140 | int16_t sample_payload[frame_size]; |
137 | randombytes_salsa20_random_buf(sample_payload, sizeof(int16_t) * frame_size); | 141 | randombytes_salsa20_random_buf(sample_payload, sizeof(int16_t) * frame_size); |
138 | 142 | ||
139 | uint8_t prepared_payload[RTP_PAYLOAD_SIZE]; | 143 | uint8_t prepared_payload[RTP_PAYLOAD_SIZE]; |
140 | 144 | ||
141 | 145 | ||
142 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ | 146 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ |
143 | while (running) { | 147 | while (running) { |
144 | 148 | ||
145 | switch ( step ) { | 149 | switch ( step ) { |
146 | case 0: /* CALLER */ | 150 | case 0: /* CALLER */ |
147 | toxav_call(this_call->Caller.av, &call_idx, this_call->Callee.id, TypeVideo, 10); | 151 | toxav_call(this_call->Caller.av, &call_idx, this_call->Callee.id, TypeVideo, 10); |
148 | call_print(call_idx, "Calling ..."); | 152 | call_print(call_idx, "Calling ..."); |
149 | step++; | 153 | step++; |
150 | break; | 154 | break; |
151 | case 1: /* CALLEE */ | 155 | |
152 | if (this_call->Caller.status == Ringing) { | 156 | case 1: /* CALLEE */ |
157 | if (this_call->Caller.status == Ringing) { | ||
153 | call_print(call_idx, "Callee answers ..."); | 158 | call_print(call_idx, "Callee answers ..."); |
154 | toxav_answer(this_call->Callee.av, 0, TypeVideo); | 159 | toxav_answer(this_call->Callee.av, 0, TypeVideo); |
155 | step++; | 160 | step++; |
156 | start = time(NULL); | 161 | start = time(NULL); |
157 | } break; | 162 | } |
158 | case 2: /* Rtp transmission */ | 163 | |
164 | break; | ||
165 | |||
166 | case 2: /* Rtp transmission */ | ||
159 | if (this_call->Caller.status == InCall) { /* I think this is okay */ | 167 | if (this_call->Caller.status == InCall) { /* I think this is okay */ |
160 | call_print(call_idx, "Sending rtp ..."); | 168 | call_print(call_idx, "Sending rtp ..."); |
161 | 169 | ||
162 | ToxAvCodecSettings cast = av_DefaultSettings; | 170 | ToxAvCodecSettings cast = av_DefaultSettings; |
163 | 171 | ||
164 | c_sleep(1000); /* We have race condition here */ | 172 | c_sleep(1000); /* We have race condition here */ |
165 | toxav_prepare_transmission(this_call->Callee.av, 0, &cast, 1); | 173 | toxav_prepare_transmission(this_call->Callee.av, 0, &cast, 1); |
166 | toxav_prepare_transmission(this_call->Caller.av, call_idx, &cast, 1); | 174 | toxav_prepare_transmission(this_call->Caller.av, call_idx, &cast, 1); |
167 | 175 | ||
168 | int payload_size = toxav_prepare_audio_frame(this_call->Caller.av, call_idx, prepared_payload, RTP_PAYLOAD_SIZE, sample_payload, frame_size); | 176 | int payload_size = toxav_prepare_audio_frame(this_call->Caller.av, call_idx, prepared_payload, RTP_PAYLOAD_SIZE, |
177 | sample_payload, frame_size); | ||
178 | |||
169 | if ( payload_size < 0 ) { | 179 | if ( payload_size < 0 ) { |
170 | ck_assert_msg ( 0, "Failed to encode payload" ); | 180 | ck_assert_msg ( 0, "Failed to encode payload" ); |
171 | } | 181 | } |
172 | 182 | ||
173 | 183 | ||
174 | while (time(NULL) - start < 10) { /* 10 seconds */ | 184 | while (time(NULL) - start < 10) { /* 10 seconds */ |
175 | /* Both send */ | 185 | /* Both send */ |
176 | toxav_send_audio(this_call->Caller.av, call_idx, prepared_payload, payload_size); | 186 | toxav_send_audio(this_call->Caller.av, call_idx, prepared_payload, payload_size); |
177 | 187 | ||
178 | toxav_send_audio(this_call->Callee.av, 0, prepared_payload, payload_size); | 188 | toxav_send_audio(this_call->Callee.av, 0, prepared_payload, payload_size); |
179 | 189 | ||
180 | /* Both receive */ | 190 | /* Both receive */ |
181 | int16_t storage[RTP_PAYLOAD_SIZE]; | 191 | int16_t storage[RTP_PAYLOAD_SIZE]; |
182 | int recved; | 192 | int recved; |
183 | 193 | ||
184 | /* Payload from CALLER */ | 194 | /* Payload from CALLER */ |
185 | recved = toxav_recv_audio(this_call->Callee.av, 0, frame_size, storage); | 195 | recved = toxav_recv_audio(this_call->Callee.av, 0, frame_size, storage); |
186 | 196 | ||
187 | if ( recved ) { | 197 | if ( recved ) { |
188 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLER is invalid");*/ | 198 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLER is invalid");*/ |
189 | } | 199 | } |
190 | 200 | ||
191 | /* Payload from CALLEE */ | 201 | /* Payload from CALLEE */ |
192 | recved = toxav_recv_audio(this_call->Caller.av, call_idx, frame_size, storage); | 202 | recved = toxav_recv_audio(this_call->Caller.av, call_idx, frame_size, storage); |
193 | 203 | ||
194 | if ( recved ) { | 204 | if ( recved ) { |
195 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLEE is invalid");*/ | 205 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLEE is invalid");*/ |
196 | } | 206 | } |
197 | 207 | ||
198 | c_sleep(20); | 208 | c_sleep(20); |
199 | } | 209 | } |
200 | 210 | ||
201 | step++; /* This terminates the loop */ | 211 | step++; /* This terminates the loop */ |
202 | 212 | ||
203 | toxav_kill_transmission(this_call->Callee.av, 0); | 213 | toxav_kill_transmission(this_call->Callee.av, 0); |
204 | toxav_kill_transmission(this_call->Caller.av, call_idx); | 214 | toxav_kill_transmission(this_call->Caller.av, call_idx); |
205 | 215 | ||
206 | /* Call over CALLER hangs up */ | 216 | /* Call over CALLER hangs up */ |
207 | toxav_hangup(this_call->Caller.av, call_idx); | 217 | toxav_hangup(this_call->Caller.av, call_idx); |
208 | call_print(call_idx, "Hanging up ..."); | 218 | call_print(call_idx, "Hanging up ..."); |
209 | } | 219 | } |
220 | |||
210 | break; | 221 | break; |
222 | |||
211 | case 3: /* Wait for Both to have status ended */ | 223 | case 3: /* Wait for Both to have status ended */ |
212 | if (this_call->Caller.status == Ended) { | 224 | if (this_call->Caller.status == Ended) { |
213 | c_sleep(1000); /* race condition */ | 225 | c_sleep(1000); /* race condition */ |
214 | this_call->Callee.status == Ended; | 226 | this_call->Callee.status == Ended; |
215 | running = 0; | 227 | running = 0; |
216 | } | 228 | } |
217 | 229 | ||
218 | break; | 230 | break; |
219 | 231 | ||
220 | } | 232 | } |
233 | |||
221 | c_sleep(20); | 234 | c_sleep(20); |
222 | } | 235 | } |
223 | 236 | ||
224 | call_print(call_idx, "Call ended successfully!"); | 237 | call_print(call_idx, "Call ended successfully!"); |
225 | pthread_exit(NULL); | 238 | pthread_exit(NULL); |
226 | } | 239 | } |
@@ -240,120 +253,122 @@ START_TEST(test_AV_three_calls) | |||
240 | tox_new(0), | 253 | tox_new(0), |
241 | tox_new(0), | 254 | tox_new(0), |
242 | }; | 255 | }; |
243 | 256 | ||
244 | 257 | ||
245 | ck_assert_msg(bootstrap_node != NULL, "Failed to create bootstrap node"); | 258 | ck_assert_msg(bootstrap_node != NULL, "Failed to create bootstrap node"); |
246 | 259 | ||
247 | int i = 0; | 260 | int i = 0; |
261 | |||
248 | for (; i < 3; i ++) { | 262 | for (; i < 3; i ++) { |
249 | ck_assert_msg(callees[i] != NULL, "Failed to create 3 tox instances"); | 263 | ck_assert_msg(callees[i] != NULL, "Failed to create 3 tox instances"); |
250 | } | 264 | } |
251 | 265 | ||
252 | for ( i = 0; i < 3; i ++ ) { | 266 | for ( i = 0; i < 3; i ++ ) { |
253 | uint32_t to_compare = 974536; | 267 | uint32_t to_compare = 974536; |
254 | tox_callback_friend_request(callees[i], accept_friend_request, &to_compare); | 268 | tox_callback_friend_request(callees[i], accept_friend_request, &to_compare); |
255 | uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; | 269 | uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; |
256 | tox_get_address(callees[i], address); | 270 | tox_get_address(callees[i], address); |
257 | 271 | ||
258 | int test = tox_add_friend(caller, address, (uint8_t *)"gentoo", 7); | 272 | int test = tox_add_friend(caller, address, (uint8_t *)"gentoo", 7); |
259 | ck_assert_msg( test == i, "Failed to add friend error code: %i", test); | 273 | ck_assert_msg( test == i, "Failed to add friend error code: %i", test); |
260 | } | 274 | } |
261 | 275 | ||
262 | uint8_t off = 1; | 276 | uint8_t off = 1; |
263 | 277 | ||
264 | while (1) { | 278 | while (1) { |
265 | tox_do(bootstrap_node); | 279 | tox_do(bootstrap_node); |
266 | tox_do(caller); | 280 | tox_do(caller); |
267 | 281 | ||
268 | for (i = 0; i < 3; i ++) { | 282 | for (i = 0; i < 3; i ++) { |
269 | tox_do(callees[i]); | 283 | tox_do(callees[i]); |
270 | } | 284 | } |
271 | 285 | ||
272 | 286 | ||
273 | if (tox_isconnected(bootstrap_node) && | 287 | if (tox_isconnected(bootstrap_node) && |
274 | tox_isconnected(caller) && | 288 | tox_isconnected(caller) && |
275 | tox_isconnected(callees[0]) && | 289 | tox_isconnected(callees[0]) && |
276 | tox_isconnected(callees[1]) && | 290 | tox_isconnected(callees[1]) && |
277 | tox_isconnected(callees[2]) && off) { | 291 | tox_isconnected(callees[2]) && off) { |
278 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); | 292 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); |
279 | off = 0; | 293 | off = 0; |
280 | } | 294 | } |
281 | 295 | ||
282 | 296 | ||
283 | if (tox_get_friend_connection_status(caller, 0) == 1 && | 297 | if (tox_get_friend_connection_status(caller, 0) == 1 && |
284 | tox_get_friend_connection_status(caller, 1) == 1 && | 298 | tox_get_friend_connection_status(caller, 1) == 1 && |
285 | tox_get_friend_connection_status(caller, 2) == 1 ) | 299 | tox_get_friend_connection_status(caller, 2) == 1 ) |
286 | break; | 300 | break; |
287 | 301 | ||
288 | c_sleep(20); | 302 | c_sleep(20); |
289 | } | 303 | } |
290 | 304 | ||
291 | printf("All set after %llu seconds! Starting call...\n", time(NULL) - cur_time); | 305 | printf("All set after %llu seconds! Starting call...\n", time(NULL) - cur_time); |
292 | 306 | ||
293 | ToxAv* uniqcallerav = toxav_new(caller, 3); | 307 | ToxAv *uniqcallerav = toxav_new(caller, 3); |
294 | 308 | ||
295 | Status status_control = { | 309 | Status status_control = { |
296 | 0, | 310 | 0, |
297 | {none, uniqcallerav, 0}, | 311 | {none, uniqcallerav, 0}, |
298 | {none, toxav_new(callees[0], 1), 0}, | 312 | {none, toxav_new(callees[0], 1), 0}, |
299 | 313 | ||
300 | 0, | 314 | 0, |
301 | {none, uniqcallerav}, | 315 | {none, uniqcallerav}, |
302 | {none, toxav_new(callees[1], 1), 1}, | 316 | {none, toxav_new(callees[1], 1), 1}, |
303 | 317 | ||
304 | 0, | 318 | 0, |
305 | {none, uniqcallerav}, | 319 | {none, uniqcallerav}, |
306 | {none, toxav_new(callees[2], 1), 2} | 320 | {none, toxav_new(callees[2], 1), 2} |
307 | }; | 321 | }; |
308 | 322 | ||
309 | 323 | ||
310 | toxav_register_callstate_callback(callback_call_started, av_OnStart, &status_control); | 324 | toxav_register_callstate_callback(callback_call_started, av_OnStart, &status_control); |
311 | toxav_register_callstate_callback(callback_call_canceled, av_OnCancel, &status_control); | 325 | toxav_register_callstate_callback(callback_call_canceled, av_OnCancel, &status_control); |
312 | toxav_register_callstate_callback(callback_call_rejected, av_OnReject, &status_control); | 326 | toxav_register_callstate_callback(callback_call_rejected, av_OnReject, &status_control); |
313 | toxav_register_callstate_callback(callback_call_ended, av_OnEnd, &status_control); | 327 | toxav_register_callstate_callback(callback_call_ended, av_OnEnd, &status_control); |
314 | toxav_register_callstate_callback(callback_recv_invite, av_OnInvite, &status_control); | 328 | toxav_register_callstate_callback(callback_recv_invite, av_OnInvite, &status_control); |
315 | 329 | ||
316 | toxav_register_callstate_callback(callback_recv_ringing, av_OnRinging, &status_control); | 330 | toxav_register_callstate_callback(callback_recv_ringing, av_OnRinging, &status_control); |
317 | toxav_register_callstate_callback(callback_recv_starting, av_OnStarting, &status_control); | 331 | toxav_register_callstate_callback(callback_recv_starting, av_OnStarting, &status_control); |
318 | toxav_register_callstate_callback(callback_recv_ending, av_OnEnding, &status_control); | 332 | toxav_register_callstate_callback(callback_recv_ending, av_OnEnding, &status_control); |
319 | 333 | ||
320 | toxav_register_callstate_callback(callback_recv_error, av_OnError, &status_control); | 334 | toxav_register_callstate_callback(callback_recv_error, av_OnError, &status_control); |
321 | toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, &status_control); | 335 | toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, &status_control); |
322 | 336 | ||
323 | 337 | ||
324 | 338 | ||
325 | for ( i = 0; i < 3; i++ ) | 339 | for ( i = 0; i < 3; i++ ) |
326 | pthread_create(&status_control.calls[i].tid, NULL, in_thread_call, &status_control.calls[i]); | 340 | pthread_create(&status_control.calls[i].tid, NULL, in_thread_call, &status_control.calls[i]); |
327 | 341 | ||
328 | 342 | ||
329 | /* Now start 3 calls and they'll run for 10 s */ | 343 | /* Now start 3 calls and they'll run for 10 s */ |
330 | 344 | ||
331 | for ( i = 0; i < 3; i++ ) | 345 | for ( i = 0; i < 3; i++ ) |
332 | pthread_detach(status_control.calls[i].tid); | 346 | pthread_detach(status_control.calls[i].tid); |
333 | 347 | ||
334 | while ( | 348 | while ( |
335 | status_control.calls[0].Callee.status != Ended && status_control.calls[0].Caller.status != Ended && | 349 | status_control.calls[0].Callee.status != Ended && status_control.calls[0].Caller.status != Ended && |
336 | status_control.calls[1].Callee.status != Ended && status_control.calls[1].Caller.status != Ended && | 350 | status_control.calls[1].Callee.status != Ended && status_control.calls[1].Caller.status != Ended && |
337 | status_control.calls[2].Callee.status != Ended && status_control.calls[2].Caller.status != Ended | 351 | status_control.calls[2].Callee.status != Ended && status_control.calls[2].Caller.status != Ended |
338 | ) { | 352 | ) { |
339 | tox_do(bootstrap_node); | 353 | tox_do(bootstrap_node); |
340 | tox_do(caller); | 354 | tox_do(caller); |
341 | tox_do(callees[0]); | 355 | tox_do(callees[0]); |
342 | tox_do(callees[1]); | 356 | tox_do(callees[1]); |
343 | tox_do(callees[2]); | 357 | tox_do(callees[2]); |
344 | c_sleep(20); | 358 | c_sleep(20); |
345 | } | 359 | } |
346 | 360 | ||
347 | toxav_kill(status_control.calls[0].Caller.av); | 361 | toxav_kill(status_control.calls[0].Caller.av); |
348 | toxav_kill(status_control.calls[0].Callee.av); | 362 | toxav_kill(status_control.calls[0].Callee.av); |
349 | toxav_kill(status_control.calls[1].Callee.av); | 363 | toxav_kill(status_control.calls[1].Callee.av); |
350 | toxav_kill(status_control.calls[2].Callee.av); | 364 | toxav_kill(status_control.calls[2].Callee.av); |
351 | 365 | ||
352 | tox_kill(bootstrap_node); | 366 | tox_kill(bootstrap_node); |
353 | tox_kill(caller); | 367 | tox_kill(caller); |
368 | |||
354 | for ( i = 0; i < 3; i ++) | 369 | for ( i = 0; i < 3; i ++) |
355 | tox_kill(callees[i]); | 370 | tox_kill(callees[i]); |
356 | 371 | ||
357 | } | 372 | } |
358 | END_TEST | 373 | END_TEST |
359 | 374 | ||
@@ -363,29 +378,29 @@ END_TEST | |||
363 | Suite *tox_suite(void) | 378 | Suite *tox_suite(void) |
364 | { | 379 | { |
365 | Suite *s = suite_create("ToxAV"); | 380 | Suite *s = suite_create("ToxAV"); |
366 | 381 | ||
367 | TCase *tc_av_three_calls = tcase_create("AV_three_calls"); | 382 | TCase *tc_av_three_calls = tcase_create("AV_three_calls"); |
368 | tcase_add_test(tc_av_three_calls, test_AV_three_calls); | 383 | tcase_add_test(tc_av_three_calls, test_AV_three_calls); |
369 | tcase_set_timeout(tc_av_three_calls, 150); | 384 | tcase_set_timeout(tc_av_three_calls, 150); |
370 | suite_add_tcase(s, tc_av_three_calls); | 385 | suite_add_tcase(s, tc_av_three_calls); |
371 | 386 | ||
372 | return s; | 387 | return s; |
373 | } | 388 | } |
374 | int main(int argc, char *argv[]) | 389 | int main(int argc, char *argv[]) |
375 | { | 390 | { |
376 | Suite *tox = tox_suite(); | 391 | Suite *tox = tox_suite(); |
377 | SRunner *test_runner = srunner_create(tox); | 392 | SRunner *test_runner = srunner_create(tox); |
378 | 393 | ||
379 | setbuf(stdout, NULL); | 394 | setbuf(stdout, NULL); |
380 | 395 | ||
381 | srunner_run_all(test_runner, CK_NORMAL); | 396 | srunner_run_all(test_runner, CK_NORMAL); |
382 | int number_failed = srunner_ntests_failed(test_runner); | 397 | int number_failed = srunner_ntests_failed(test_runner); |
383 | 398 | ||
384 | srunner_free(test_runner); | 399 | srunner_free(test_runner); |
385 | 400 | ||
386 | return number_failed; | 401 | return number_failed; |
387 | 402 | ||
388 | // test_AV_three_calls(); | 403 | // test_AV_three_calls(); |
389 | // | 404 | // |
390 | // return 0; | 405 | // return 0; |
391 | } \ No newline at end of file | 406 | } \ No newline at end of file |