mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fix assert for the first port value
Port of the first tox instance will be 33445 only if this port was not in use during testing
This commit is contained in:
parent
2651193b99
commit
c506d73d5d
|
@ -106,7 +106,9 @@ group_test_restart:
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
const uint16_t port = tox_self_get_udp_port(toxes[0], &error);
|
||||||
|
ck_assert_msg(33445 <= port && port <= 33545,
|
||||||
|
"First Tox instance did not bind to udp port inside [33445, 33545].\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,9 @@ START_TEST(test_many_clients_tcp)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
uint16_t port = tox_self_get_udp_port(toxes[0], &error);
|
||||||
|
ck_assert_msg(33445 <= port && port <= 33545,
|
||||||
|
"First Tox instance did not bind to udp port inside [33445, 33545].\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
ck_assert_msg(tox_self_get_tcp_port(toxes[0], &error) == TCP_RELAY_PORT,
|
ck_assert_msg(tox_self_get_tcp_port(toxes[0], &error) == TCP_RELAY_PORT,
|
||||||
"First Tox instance did not bind to tcp port %u.\n", TCP_RELAY_PORT);
|
"First Tox instance did not bind to tcp port %u.\n", TCP_RELAY_PORT);
|
||||||
|
@ -176,7 +178,9 @@ START_TEST(test_many_clients_tcp_b)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
uint16_t port = tox_self_get_udp_port(toxes[0], &error);
|
||||||
|
ck_assert_msg(33445 <= port && port <= 33545,
|
||||||
|
"First Tox instance did not bind to udp port inside [33445, 33545].\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
ck_assert_msg(tox_self_get_tcp_port(toxes[0], &error) == TCP_RELAY_PORT,
|
ck_assert_msg(tox_self_get_tcp_port(toxes[0], &error) == TCP_RELAY_PORT,
|
||||||
"First Tox instance did not bind to tcp port %u.\n", TCP_RELAY_PORT);
|
"First Tox instance did not bind to tcp port %u.\n", TCP_RELAY_PORT);
|
||||||
|
|
|
@ -50,7 +50,9 @@ START_TEST(test_many_clients)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
uint16_t port = tox_self_get_udp_port(toxes[0], &error);
|
||||||
|
ck_assert_msg(33445 <= port && port <= 33545,
|
||||||
|
"First Tox instance did not bind to udp port inside [33445, 33545].\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,9 @@ START_TEST(test_one)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
uint16_t port = tox_self_get_udp_port(tox1, &error);
|
||||||
|
ck_assert_msg(33445 <= port && port <= 33545,
|
||||||
|
"First Tox instance did not bind to udp port inside [33445, 33545].\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,19 +331,17 @@ START_TEST(test_few_clients)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
uint16_t first_port = tox_self_get_udp_port(tox1, &error);
|
||||||
|
ck_assert_msg(33445 <= first_port && first_port <= 33545 - 2,
|
||||||
|
"First Tox instance did not bind to udp port inside [33445, 33543].\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
|
||||||
|
|
||||||
{
|
ck_assert_msg(tox_self_get_udp_port(tox2, &error) == first_port + 1,
|
||||||
TOX_ERR_GET_PORT error;
|
"Second Tox instance did not bind to udp port %d.\n", first_port + 1);
|
||||||
ck_assert_msg(tox_self_get_udp_port(tox2, &error) == 33446, "Second Tox instance did not bind to udp port 33446.\n");
|
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
|
||||||
|
|
||||||
{
|
ck_assert_msg(tox_self_get_udp_port(tox3, &error) == first_port + 2,
|
||||||
TOX_ERR_GET_PORT error;
|
"Third Tox instance did not bind to udp port %d.\n", first_port + 2);
|
||||||
ck_assert_msg(tox_self_get_udp_port(tox3, &error) == 33447, "Third Tox instance did not bind to udp port 33447.\n");
|
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user