|
8 | 8 | #include "../toxcore/TCP_server.h" |
9 | 9 | #include "../toxcore/crypto_core.h" |
10 | 10 | #include "../toxcore/mono_time.h" |
11 | | -#include "../toxcore/util.h" |
12 | 11 | #include "auto_test_support.h" |
13 | 12 |
|
14 | 13 | #define NUM_PORTS 3 |
@@ -534,6 +533,7 @@ static void test_client(void) |
534 | 533 | ip_port_tcp_s.ip = get_loopback(); |
535 | 534 |
|
536 | 535 | TCP_Client_Connection *conn = new_tcp_connection(logger, mem, mono_time, rng, ns, &ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, nullptr); |
| 536 | + ck_assert_msg(conn != nullptr, "Failed to create a TCP client connection."); |
537 | 537 | // TCP sockets might need a moment before they can be written to. |
538 | 538 | c_sleep(50); |
539 | 539 | do_tcp_connection(logger, mono_time, conn, nullptr); |
@@ -570,6 +570,7 @@ static void test_client(void) |
570 | 570 | ip_port_tcp_s.port = net_htons(ports[random_u32(rng) % NUM_PORTS]); |
571 | 571 | TCP_Client_Connection *conn2 = new_tcp_connection(logger, mem, mono_time, rng, ns, &ip_port_tcp_s, self_public_key, f2_public_key, |
572 | 572 | f2_secret_key, nullptr); |
| 573 | + ck_assert_msg(conn2 != nullptr, "Failed to create a second TCP client connection."); |
573 | 574 | c_sleep(50); |
574 | 575 |
|
575 | 576 | // The client should call this function (defined earlier) during the routing process. |
@@ -667,6 +668,7 @@ static void test_client_invalid(void) |
667 | 668 | ip_port_tcp_s.ip = get_loopback(); |
668 | 669 | TCP_Client_Connection *conn = new_tcp_connection(logger, mem, mono_time, rng, ns, &ip_port_tcp_s, |
669 | 670 | self_public_key, f_public_key, f_secret_key, nullptr); |
| 671 | + ck_assert_msg(conn != nullptr, "Failed to create a TCP client connection."); |
670 | 672 |
|
671 | 673 | // Run the client's main loop but not the server. |
672 | 674 | mono_time_update(mono_time); |
@@ -743,10 +745,12 @@ static void test_tcp_connection(void) |
743 | 745 | proxy_info.proxy_type = TCP_PROXY_NONE; |
744 | 746 | crypto_new_keypair(rng, self_public_key, self_secret_key); |
745 | 747 | TCP_Connections *tc_1 = new_tcp_connections(logger, mem, rng, ns, mono_time, self_secret_key, &proxy_info); |
| 748 | + ck_assert_msg(tc_1 != nullptr, "Failed to create TCP connections"); |
746 | 749 | ck_assert_msg(pk_equal(tcp_connections_public_key(tc_1), self_public_key), "Wrong public key"); |
747 | 750 |
|
748 | 751 | crypto_new_keypair(rng, self_public_key, self_secret_key); |
749 | 752 | TCP_Connections *tc_2 = new_tcp_connections(logger, mem, rng, ns, mono_time, self_secret_key, &proxy_info); |
| 753 | + ck_assert_msg(tc_2 != nullptr, "Failed to create TCP connections"); |
750 | 754 | ck_assert_msg(pk_equal(tcp_connections_public_key(tc_2), self_public_key), "Wrong public key"); |
751 | 755 |
|
752 | 756 | IP_Port ip_port_tcp_s; |
@@ -858,10 +862,12 @@ static void test_tcp_connection2(void) |
858 | 862 | proxy_info.proxy_type = TCP_PROXY_NONE; |
859 | 863 | crypto_new_keypair(rng, self_public_key, self_secret_key); |
860 | 864 | TCP_Connections *tc_1 = new_tcp_connections(logger, mem, rng, ns, mono_time, self_secret_key, &proxy_info); |
| 865 | + ck_assert_msg(tc_1 != nullptr, "Failed to create TCP connections"); |
861 | 866 | ck_assert_msg(pk_equal(tcp_connections_public_key(tc_1), self_public_key), "Wrong public key"); |
862 | 867 |
|
863 | 868 | crypto_new_keypair(rng, self_public_key, self_secret_key); |
864 | 869 | TCP_Connections *tc_2 = new_tcp_connections(logger, mem, rng, ns, mono_time, self_secret_key, &proxy_info); |
| 870 | + ck_assert_msg(tc_2 != nullptr, "Failed to create TCP connections"); |
865 | 871 | ck_assert_msg(pk_equal(tcp_connections_public_key(tc_2), self_public_key), "Wrong public key"); |
866 | 872 |
|
867 | 873 | IP_Port ip_port_tcp_s; |
|
0 commit comments