Skip to content

Commit

Permalink
Check subscriber count for publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianReimold committed Nov 20, 2024
1 parent 5b3a88b commit d71feb0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/tcp_pubsub_test/src/tcp_pubsub_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ TEST(tcp_pubsub, basic_test)

// Check that the subscriber is connected
EXPECT_TRUE(hello_world_subscriber.getSessions().at(0)->isConnected());
EXPECT_EQ(hello_world_publisher.getSubscriberCount(), 1);

// Publish "Hello World 1"
{
Expand Down Expand Up @@ -131,6 +132,7 @@ TEST(tcp_pubsub, large_message_test)

// Check that the subscriber is connected
EXPECT_TRUE(hello_world_subscriber.getSessions().at(0)->isConnected());
EXPECT_EQ(hello_world_publisher.getSubscriberCount(), 1);

// Create a large message consisting of random bytes
std::string message;
Expand Down Expand Up @@ -198,6 +200,8 @@ TEST(tcp_pubsub, multiple_publishers_test)
// Check that the subscriber is connected
EXPECT_TRUE(hello_world_subscriber.getSessions().at(0)->isConnected());
EXPECT_TRUE(hello_world_subscriber.getSessions().at(1)->isConnected());
EXPECT_EQ(hello_world_publisher1.getSubscriberCount(), 1);
EXPECT_EQ(hello_world_publisher2.getSubscriberCount(), 1);

// Publish "Hello World 1"
{
Expand Down Expand Up @@ -283,6 +287,7 @@ TEST(tcp_pubsub, multiple_subscribers_test)
// Check that the subscriber is connected
EXPECT_TRUE(hello_world_subscriber1.getSessions().at(0)->isConnected());
EXPECT_TRUE(hello_world_subscriber2.getSessions().at(0)->isConnected());
EXPECT_EQ(hello_world_publisher.getSubscriberCount(), 2);

// Publish "Hello World 1"
{
Expand Down

0 comments on commit d71feb0

Please sign in to comment.