Skip to content

Commit

Permalink
Fixed bugs in the test and improved testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikolaj Malecki committed Jan 14, 2025
1 parent 9852ae1 commit 62e3500
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions test/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ TEST(General, Startup)
EXPECT_EQ(srt::CUDT::uglobal().getInstanceStatus(), std::make_pair(1, true));

EXPECT_EQ(srt_close(sock), 0);

// Do the cleanup again, to not leave it up to the global destructor.
EXPECT_EQ(srt_cleanup(), 0);
}

void test_cipaddress_pton(const char* peer_ip, int family, const uint32_t (&ip)[4])
Expand Down Expand Up @@ -76,6 +79,8 @@ void test_cipaddress_pton(const char* peer_ip, int family, const uint32_t (&ip)[
// Example IPv4 address: 192.168.0.1
TEST(CIPAddress, IPv4_pton)
{
// Check the NEXT TEST of General/Startup, if it has done the cleanup.
EXPECT_EQ(srt::CUDT::uglobal().getInstanceStatus(), std::make_pair(0, false));
srt::TestInit srtinit;
const char* peer_ip = "192.168.0.1";
const uint32_t ip[4] = {htobe32(0xC0A80001), 0, 0, 0};
Expand Down
4 changes: 1 addition & 3 deletions test/test_connection_timeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ TEST(TestConnectionAPI, Accept)
using namespace std::chrono;
using namespace srt;

srt_startup();
TestInit srtinit;

const SRTSOCKET caller_sock = srt_create_socket();
const SRTSOCKET listener_sock = srt_create_socket();
Expand Down Expand Up @@ -266,8 +266,6 @@ TEST(TestConnectionAPI, Accept)
}
srt_close(caller_sock);
srt_close(listener_sock);

srt_cleanup();
}


0 comments on commit 62e3500

Please sign in to comment.