diff options
author | Diadlo <polsha3@gmail.com> | 2017-03-03 21:30:11 +0300 |
---|---|---|
committer | Diadlo <polsha3@gmail.com> | 2017-03-25 20:40:34 +0300 |
commit | 50c526e1a5349bd69ce29dda703e914fb755ccf4 (patch) | |
tree | 52321368957f105c5db3e86fdbf7b6c47e848f7e /auto_tests | |
parent | a1f9df48d61ccc34e35bf98c3c61ec7861e8e1b6 (diff) |
Move c_sleep to helpers.h and misc_tools.h
Also fix a mistake with forgotten braces around parameter
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/TCP_test.c | 7 | ||||
-rw-r--r-- | auto_tests/conference_test.c | 9 | ||||
-rw-r--r-- | auto_tests/dht_test.c | 8 | ||||
-rw-r--r-- | auto_tests/helpers.h | 8 | ||||
-rw-r--r-- | auto_tests/onion_test.c | 7 | ||||
-rw-r--r-- | auto_tests/save_friend_test.c | 8 | ||||
-rw-r--r-- | auto_tests/tox_many_tcp_test.c | 8 | ||||
-rw-r--r-- | auto_tests/tox_many_test.c | 8 | ||||
-rw-r--r-- | auto_tests/tox_test.c | 8 | ||||
-rw-r--r-- | auto_tests/toxav_basic_test.c | 9 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 8 |
11 files changed, 9 insertions, 79 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c index bc684af9..769ba5de 100644 --- a/auto_tests/TCP_test.c +++ b/auto_tests/TCP_test.c | |||
@@ -18,13 +18,6 @@ | |||
18 | 18 | ||
19 | #include "helpers.h" | 19 | #include "helpers.h" |
20 | 20 | ||
21 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
22 | #define c_sleep(x) Sleep(1*x) | ||
23 | #else | ||
24 | #include <unistd.h> | ||
25 | #define c_sleep(x) usleep(1000*x) | ||
26 | #endif | ||
27 | |||
28 | #define NUM_PORTS 3 | 21 | #define NUM_PORTS 3 |
29 | 22 | ||
30 | static uint16_t ports[NUM_PORTS] = {1234, 33445, 25643}; | 23 | static uint16_t ports[NUM_PORTS] = {1234, 33445, 25643}; |
diff --git a/auto_tests/conference_test.c b/auto_tests/conference_test.c index 36707e0f..33110441 100644 --- a/auto_tests/conference_test.c +++ b/auto_tests/conference_test.c | |||
@@ -17,15 +17,6 @@ | |||
17 | 17 | ||
18 | #include "helpers.h" | 18 | #include "helpers.h" |
19 | 19 | ||
20 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
21 | #include <windows.h> | ||
22 | #define c_sleep(x) Sleep(1*x) | ||
23 | #else | ||
24 | #include <unistd.h> | ||
25 | #define c_sleep(x) usleep(1000*x) | ||
26 | #endif | ||
27 | |||
28 | |||
29 | #define NUM_GROUP_TOX 32 | 20 | #define NUM_GROUP_TOX 32 |
30 | 21 | ||
31 | static void g_accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, | 22 | static void g_accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, |
diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c index 479b0eb8..6ed84098 100644 --- a/auto_tests/dht_test.c +++ b/auto_tests/dht_test.c | |||
@@ -571,14 +571,6 @@ static void ip_callback(void *data, int32_t number, IP_Port ip_port) | |||
571 | { | 571 | { |
572 | } | 572 | } |
573 | 573 | ||
574 | |||
575 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
576 | #define c_sleep(x) Sleep(1*x) | ||
577 | #else | ||
578 | #include <unistd.h> | ||
579 | #define c_sleep(x) usleep(1000*x) | ||
580 | #endif | ||
581 | |||
582 | #define NUM_DHT_FRIENDS 20 | 574 | #define NUM_DHT_FRIENDS 20 |
583 | 575 | ||
584 | START_TEST(test_DHT_test) | 576 | START_TEST(test_DHT_test) |
diff --git a/auto_tests/helpers.h b/auto_tests/helpers.h index 5cec575c..e5860449 100644 --- a/auto_tests/helpers.h +++ b/auto_tests/helpers.h | |||
@@ -7,6 +7,14 @@ | |||
7 | #include <check.h> | 7 | #include <check.h> |
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | 9 | ||
10 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
11 | #include <windows.h> | ||
12 | #define c_sleep(x) Sleep(x) | ||
13 | #else | ||
14 | #include <unistd.h> | ||
15 | #define c_sleep(x) usleep(1000*(x)) | ||
16 | #endif | ||
17 | |||
10 | #define DEFTESTCASE(NAME) \ | 18 | #define DEFTESTCASE(NAME) \ |
11 | TCase *tc_##NAME = tcase_create(#NAME); \ | 19 | TCase *tc_##NAME = tcase_create(#NAME); \ |
12 | tcase_add_test(tc_##NAME, test_##NAME); \ | 20 | tcase_add_test(tc_##NAME, test_##NAME); \ |
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c index 05264927..c52bbb58 100644 --- a/auto_tests/onion_test.c +++ b/auto_tests/onion_test.c | |||
@@ -18,13 +18,6 @@ | |||
18 | 18 | ||
19 | #include "helpers.h" | 19 | #include "helpers.h" |
20 | 20 | ||
21 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
22 | #define c_sleep(x) Sleep(1*x) | ||
23 | #else | ||
24 | #include <unistd.h> | ||
25 | #define c_sleep(x) usleep(1000*x) | ||
26 | #endif | ||
27 | |||
28 | static void do_onion(Onion *onion) | 21 | static void do_onion(Onion *onion) |
29 | { | 22 | { |
30 | networking_poll(onion->net, NULL); | 23 | networking_poll(onion->net, NULL); |
diff --git a/auto_tests/save_friend_test.c b/auto_tests/save_friend_test.c index 6d0640c3..061425bd 100644 --- a/auto_tests/save_friend_test.c +++ b/auto_tests/save_friend_test.c | |||
@@ -12,14 +12,6 @@ | |||
12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
13 | #include <string.h> | 13 | #include <string.h> |
14 | 14 | ||
15 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
16 | #include <windows.h> | ||
17 | #define c_sleep(x) Sleep(1*x) | ||
18 | #else | ||
19 | #include <unistd.h> | ||
20 | #define c_sleep(x) usleep(1000*x) | ||
21 | #endif | ||
22 | |||
23 | struct test_data { | 15 | struct test_data { |
24 | uint8_t name[TOX_MAX_NAME_LENGTH]; | 16 | uint8_t name[TOX_MAX_NAME_LENGTH]; |
25 | uint8_t status_message[TOX_MAX_STATUS_MESSAGE_LENGTH]; | 17 | uint8_t status_message[TOX_MAX_STATUS_MESSAGE_LENGTH]; |
diff --git a/auto_tests/tox_many_tcp_test.c b/auto_tests/tox_many_tcp_test.c index 48f5671c..77c611d9 100644 --- a/auto_tests/tox_many_tcp_test.c +++ b/auto_tests/tox_many_tcp_test.c | |||
@@ -17,14 +17,6 @@ | |||
17 | 17 | ||
18 | #include "helpers.h" | 18 | #include "helpers.h" |
19 | 19 | ||
20 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
21 | #include <windows.h> | ||
22 | #define c_sleep(x) Sleep(1*x) | ||
23 | #else | ||
24 | #include <unistd.h> | ||
25 | #define c_sleep(x) usleep(1000*x) | ||
26 | #endif | ||
27 | |||
28 | /* The Travis-CI container responds poorly to ::1 as a localhost address | 20 | /* The Travis-CI container responds poorly to ::1 as a localhost address |
29 | * You're encouraged to -D FORCE_TESTS_IPV6 on a local test */ | 21 | * You're encouraged to -D FORCE_TESTS_IPV6 on a local test */ |
30 | #ifdef FORCE_TESTS_IPV6 | 22 | #ifdef FORCE_TESTS_IPV6 |
diff --git a/auto_tests/tox_many_test.c b/auto_tests/tox_many_test.c index b44bbb0c..1a1a715d 100644 --- a/auto_tests/tox_many_test.c +++ b/auto_tests/tox_many_test.c | |||
@@ -17,14 +17,6 @@ | |||
17 | 17 | ||
18 | #include "helpers.h" | 18 | #include "helpers.h" |
19 | 19 | ||
20 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
21 | #include <windows.h> | ||
22 | #define c_sleep(x) Sleep(1*x) | ||
23 | #else | ||
24 | #include <unistd.h> | ||
25 | #define c_sleep(x) usleep(1000*x) | ||
26 | #endif | ||
27 | |||
28 | static void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) | 20 | static void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) |
29 | { | 21 | { |
30 | if (*((uint32_t *)userdata) != 974536) { | 22 | if (*((uint32_t *)userdata) != 974536) { |
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index d9074ac0..f3557226 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -27,14 +27,6 @@ | |||
27 | 27 | ||
28 | #include "helpers.h" | 28 | #include "helpers.h" |
29 | 29 | ||
30 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | ||
31 | #include <windows.h> | ||
32 | #define c_sleep(x) Sleep(1*x) | ||
33 | #else | ||
34 | #include <unistd.h> | ||
35 | #define c_sleep(x) usleep(1000*x) | ||
36 | #endif | ||
37 | |||
38 | /* The Travis-CI container responds poorly to ::1 as a localhost address | 30 | /* The Travis-CI container responds poorly to ::1 as a localhost address |
39 | * You're encouraged to -D FORCE_TESTS_IPV6 on a local test */ | 31 | * You're encouraged to -D FORCE_TESTS_IPV6 on a local test */ |
40 | #ifdef FORCE_TESTS_IPV6 | 32 | #ifdef FORCE_TESTS_IPV6 |
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 79f552de..2885d8be 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -22,15 +22,6 @@ | |||
22 | #include "../toxcore/util.h" | 22 | #include "../toxcore/util.h" |
23 | 23 | ||
24 | 24 | ||
25 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) | ||
26 | #include <windows.h> | ||
27 | #define c_sleep(x) Sleep(1*x) | ||
28 | #else | ||
29 | #include <unistd.h> | ||
30 | #define c_sleep(x) usleep(1000*x) | ||
31 | #endif | ||
32 | |||
33 | |||
34 | #define TEST_REGULAR_AV 1 | 25 | #define TEST_REGULAR_AV 1 |
35 | #define TEST_REGULAR_A 1 | 26 | #define TEST_REGULAR_A 1 |
36 | #define TEST_REGULAR_V 1 | 27 | #define TEST_REGULAR_V 1 |
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index 1a10db44..83a7b313 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -21,16 +21,10 @@ | |||
21 | #include "../toxcore/tox.h" | 21 | #include "../toxcore/tox.h" |
22 | #include "../toxcore/util.h" | 22 | #include "../toxcore/util.h" |
23 | 23 | ||
24 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) | 24 | #if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32) |
25 | #include <windows.h> | ||
26 | #define c_sleep(x) Sleep(1*x) | ||
27 | #else | ||
28 | #include <pthread.h> | 25 | #include <pthread.h> |
29 | #include <unistd.h> | ||
30 | #define c_sleep(x) usleep(1000*x) | ||
31 | #endif | 26 | #endif |
32 | 27 | ||
33 | |||
34 | typedef struct { | 28 | typedef struct { |
35 | bool incoming; | 29 | bool incoming; |
36 | uint32_t state; | 30 | uint32_t state; |