Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ye-Yu-Mo committed Oct 6, 2024
1 parent 8099571 commit 588d2f8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
Binary file removed test/data/message/queue1.mqd
Binary file not shown.
Binary file modified test/mqmessagetest
Binary file not shown.
48 changes: 27 additions & 21 deletions test/mqmessagetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class BindingTest : public testing::Environment
// mmp->clear();
info(XuMQ::logger, "清理完成");
}

};

// TEST(message_test, insert_test)
Expand Down Expand Up @@ -72,28 +73,33 @@ class BindingTest : public testing::Environment
// // ASSERT_EQ(mmp->waitAckCount("queue1"), 5);
// }

TEST(message_test, delete_test)
{
XuMQ::MessagePtr msg1 = mmp->front("queue1");

ASSERT_NE(msg1.get(), nullptr);
ASSERT_EQ(msg1->payload().body(), std::string("hello xu 2"));
// ASSERT_EQ(mmp->durableCount("queue1"), 9);
// ASSERT_EQ(mmp->availableCount("queue1"), 9);
// ASSERT_EQ(mmp->totalCount("queue1"), 9);
// XuMQ::MessagePtr msg1 = mmp->front("queue1");
// ASSERT_EQ(mmp->durableCount("queue1"), 9);

// ASSERT_NE(msg1.get(), nullptr);
// ASSERT_EQ(msg1->payload().body(), std::string("hello xu 1"));
// ASSERT_EQ(mmp->availableCount("queue1"), 8);
// ASSERT_EQ(mmp->waitAckCount("queue1"), 1);
// mmp->ack("queue1", msg1->payload().properties().id());
// ASSERT_EQ(mmp->availableCount("queue1"), 8);
// ASSERT_EQ(mmp->waitAckCount("queue1"), 0);
// ASSERT_EQ(mmp->durableCount("queue1"), 8);
// ASSERT_EQ(mmp->totalCount("queue1"), 9);
// TEST(message_test, delete_test)
// {
// XuMQ::MessagePtr msg1 = mmp->front("queue1");

// ASSERT_NE(msg1.get(), nullptr);
// ASSERT_EQ(msg1->payload().body(), std::string("hello xu 2"));
// // ASSERT_EQ(mmp->durableCount("queue1"), 9);
// // ASSERT_EQ(mmp->availableCount("queue1"), 9);
// // ASSERT_EQ(mmp->totalCount("queue1"), 9);
// // XuMQ::MessagePtr msg1 = mmp->front("queue1");
// // ASSERT_EQ(mmp->durableCount("queue1"), 9);

// // ASSERT_NE(msg1.get(), nullptr);
// // ASSERT_EQ(msg1->payload().body(), std::string("hello xu 1"));
// // ASSERT_EQ(mmp->availableCount("queue1"), 8);
// // ASSERT_EQ(mmp->waitAckCount("queue1"), 1);
// // mmp->ack("queue1", msg1->payload().properties().id());
// // ASSERT_EQ(mmp->availableCount("queue1"), 8);
// // ASSERT_EQ(mmp->waitAckCount("queue1"), 0);
// // ASSERT_EQ(mmp->durableCount("queue1"), 8);
// // ASSERT_EQ(mmp->totalCount("queue1"), 9);

// }

TEST(message_test, destroy_test)
{
mmp->destroyQueueMessage("queue1");
}

int main(int argc, char *argv[])
Expand Down

0 comments on commit 588d2f8

Please sign in to comment.