Skip to content

Commit

Permalink
Fix wrong assert for unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
alfred2g committed Dec 20, 2023
1 parent a25d9cf commit 9f0a6e7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/Mqtt5ClientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,7 @@ static int s_TestMqtt5SharedSubscriptionTest(Aws::Crt::Allocator *allocator, voi
client_messages++;
exchanged = client_messages.compare_exchange_strong(tested, desired);
if (exchanged == true)
//if (client_messages == 10)
// if (client_messages == 10)
{
fprintf(stderr, "client 1 future set ======\n");
client_received.set_value();
Expand Down Expand Up @@ -2033,7 +2033,7 @@ static int s_TestMqtt5SharedSubscriptionTest(Aws::Crt::Allocator *allocator, voi
client_messages++;
exchanged = client_messages.compare_exchange_strong(tested, desired);
if (exchanged == true)
//if (client_messages == 10)
// if (client_messages == 10)
{
fprintf(stderr, " client 2 future set=======\n");
client_received.set_value();
Expand Down Expand Up @@ -2132,20 +2132,20 @@ static int s_TestMqtt5SharedSubscriptionTest(Aws::Crt::Allocator *allocator, voi

fprintf(stderr, "all packets sent =========\n");
client_received.get_future().wait();
//client2_received.get_future().wait();
// client2_received.get_future().wait();
fprintf(stderr, "all packets received =========\n");

Vector<String> unsubList;
unsubList.push_back(TEST_TOPIC);
std::shared_ptr<Mqtt5::UnsubscribePacket> unsubscribe_client1 =
std::make_shared<Mqtt5::UnsubscribePacket>(allocator);
unsubscribe_client1->WithTopicFilters(unsubList);
ASSERT_FALSE(mqtt5Client->Unsubscribe(unsubscribe_client1));
ASSERT_TRUE(mqtt5Client->Unsubscribe(unsubscribe_client1));

std::shared_ptr<Mqtt5::UnsubscribePacket> unsubscribe_client2 =
std::make_shared<Mqtt5::UnsubscribePacket>(allocator);
unsubscribe_client2->WithTopicFilters(unsubList);
ASSERT_FALSE(mqtt5Client->Unsubscribe(unsubscribe_client2));
ASSERT_TRUE(mqtt5Client->Unsubscribe(unsubscribe_client2));

client_received = std::promise<void>();

Expand Down

0 comments on commit 9f0a6e7

Please sign in to comment.