diff options
author | irungentoo <irungentoo@gmail.com> | 2015-03-11 08:09:45 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-03-11 08:09:45 -0400 |
commit | 88a8a079b6601d09fadca9b80a23cef3c5232eb9 (patch) | |
tree | 35172377c1c34092912272935dbda81f94ad9ab0 /auto_tests | |
parent | 916b6aa7344ed922c3f8da04e7b2d73e2ee65411 (diff) |
Implemented the 3 low level network information functions.
Added tox_get_udp_port() to tests.
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/tox_test.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 077e51fb..d3f9472a 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -207,6 +207,12 @@ START_TEST(test_one) | |||
207 | Tox *tox1 = tox_new(0, 0, 0, 0); | 207 | Tox *tox1 = tox_new(0, 0, 0, 0); |
208 | Tox *tox2 = tox_new(0, 0, 0, 0); | 208 | Tox *tox2 = tox_new(0, 0, 0, 0); |
209 | 209 | ||
210 | { | ||
211 | TOX_ERR_GET_PORT error; | ||
212 | ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); | ||
213 | ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); | ||
214 | } | ||
215 | |||
210 | uint8_t address[TOX_ADDRESS_SIZE]; | 216 | uint8_t address[TOX_ADDRESS_SIZE]; |
211 | tox_self_get_address(tox1, address); | 217 | tox_self_get_address(tox1, address); |
212 | TOX_ERR_FRIEND_ADD error; | 218 | TOX_ERR_FRIEND_ADD error; |
@@ -272,6 +278,13 @@ START_TEST(test_few_clients) | |||
272 | Tox *tox2 = tox_new(0, 0, 0, 0); | 278 | Tox *tox2 = tox_new(0, 0, 0, 0); |
273 | Tox *tox3 = tox_new(0, 0, 0, 0); | 279 | Tox *tox3 = tox_new(0, 0, 0, 0); |
274 | ck_assert_msg(tox1 || tox2 || tox3, "Failed to create 3 tox instances"); | 280 | ck_assert_msg(tox1 || tox2 || tox3, "Failed to create 3 tox instances"); |
281 | |||
282 | { | ||
283 | TOX_ERR_GET_PORT error; | ||
284 | ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); | ||
285 | ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); | ||
286 | } | ||
287 | |||
275 | uint32_t to_compare = 974536; | 288 | uint32_t to_compare = 974536; |
276 | tox_callback_friend_request(tox2, accept_friend_request, &to_compare); | 289 | tox_callback_friend_request(tox2, accept_friend_request, &to_compare); |
277 | uint8_t address[TOX_ADDRESS_SIZE]; | 290 | uint8_t address[TOX_ADDRESS_SIZE]; |
@@ -495,6 +508,12 @@ START_TEST(test_many_clients) | |||
495 | tox_callback_friend_request(toxes[i], accept_friend_request, &to_comp); | 508 | tox_callback_friend_request(toxes[i], accept_friend_request, &to_comp); |
496 | } | 509 | } |
497 | 510 | ||
511 | { | ||
512 | TOX_ERR_GET_PORT error; | ||
513 | ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); | ||
514 | ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); | ||
515 | } | ||
516 | |||
498 | struct { | 517 | struct { |
499 | uint16_t tox1; | 518 | uint16_t tox1; |
500 | uint16_t tox2; | 519 | uint16_t tox2; |
@@ -617,6 +636,12 @@ START_TEST(test_many_group) | |||
617 | tox_callback_group_invite(toxes[i], &print_group_invite_callback, &to_comp); | 636 | tox_callback_group_invite(toxes[i], &print_group_invite_callback, &to_comp); |
618 | } | 637 | } |
619 | 638 | ||
639 | { | ||
640 | TOX_ERR_GET_PORT error; | ||
641 | ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); | ||
642 | ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); | ||
643 | } | ||
644 | |||
620 | uint8_t address[TOX_ADDRESS_SIZE]; | 645 | uint8_t address[TOX_ADDRESS_SIZE]; |
621 | tox_self_get_address(toxes[NUM_GROUP_TOX - 1], address); | 646 | tox_self_get_address(toxes[NUM_GROUP_TOX - 1], address); |
622 | 647 | ||