diff options
Diffstat (limited to 'auto_tests/tox_test.c')
-rw-r--r-- | auto_tests/tox_test.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 13c4fc7b..5723d1c3 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -96,16 +96,21 @@ void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t | |||
96 | } | 96 | } |
97 | 97 | ||
98 | uint64_t size_recv; | 98 | uint64_t size_recv; |
99 | uint8_t num; | ||
99 | void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata) | 100 | void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata) |
100 | { | 101 | { |
101 | if (*((uint32_t *)userdata) != 974536) | 102 | if (*((uint32_t *)userdata) != 974536) |
102 | return; | 103 | return; |
103 | 104 | ||
104 | uint8_t *f_data = malloc(length); | 105 | uint8_t *f_data = malloc(length); |
105 | memset(f_data, 6, length); | 106 | memset(f_data, num, length); |
107 | ++num; | ||
106 | 108 | ||
107 | if (memcmp(f_data, data, length) == 0) | 109 | if (memcmp(f_data, data, length) == 0) { |
108 | size_recv += length; | 110 | size_recv += length; |
111 | } else { | ||
112 | printf("FILE_CORRUPTED\n"); | ||
113 | } | ||
109 | } | 114 | } |
110 | 115 | ||
111 | START_TEST(test_few_clients) | 116 | START_TEST(test_few_clients) |
@@ -228,8 +233,8 @@ START_TEST(test_few_clients) | |||
228 | ck_assert_msg(fnum != -1, "tox_new_file_sender fail"); | 233 | ck_assert_msg(fnum != -1, "tox_new_file_sender fail"); |
229 | int fpiece_size = tox_file_data_size(tox2, 0); | 234 | int fpiece_size = tox_file_data_size(tox2, 0); |
230 | uint8_t *f_data = malloc(fpiece_size); | 235 | uint8_t *f_data = malloc(fpiece_size); |
231 | memset(f_data, 6, fpiece_size); | 236 | uint8_t num = 0; |
232 | 237 | memset(f_data, num, fpiece_size); | |
233 | while (1) { | 238 | while (1) { |
234 | file_sent = 0; | 239 | file_sent = 0; |
235 | tox_do(tox1); | 240 | tox_do(tox1); |
@@ -242,6 +247,8 @@ START_TEST(test_few_clients) | |||
242 | sendf_ok = 0; | 247 | sendf_ok = 0; |
243 | tox_file_send_control(tox2, 0, 0, fnum, TOX_FILECONTROL_FINISHED, NULL, 0); | 248 | tox_file_send_control(tox2, 0, 0, fnum, TOX_FILECONTROL_FINISHED, NULL, 0); |
244 | } | 249 | } |
250 | ++num; | ||
251 | memset(f_data, num, fpiece_size); | ||
245 | 252 | ||
246 | totalf_size -= fpiece_size; | 253 | totalf_size -= fpiece_size; |
247 | } | 254 | } |