Skip to content

Commit

Permalink
msgq: fix tests to follow changes of msgq_new_queue()
Browse files Browse the repository at this point in the history
This patch fixes tests of msgq to distinguish between
msgq_new_queue() funtions of pub/sub.
  • Loading branch information
katsuster committed Nov 28, 2024
1 parent 88621bf commit 444d22f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions msgq/msgq_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST_CASE("msgq_init_subscriber")
{
remove("/dev/shm/test_queue");
msgq_queue_t q;
msgq_new_queue(&q, "test_queue", 1024);
msgq_new_queue_sub(&q, "test_queue", 1024);
REQUIRE(*q.num_readers == 0);

q.reader_id = 1;
Expand All @@ -65,7 +65,7 @@ TEST_CASE("msgq_msg_send first message")
{
remove("/dev/shm/test_queue");
msgq_queue_t q;
msgq_new_queue(&q, "test_queue", 1024);
msgq_new_queue_pub(&q, "test_queue", 1024);
msgq_init_publisher(&q);

REQUIRE(*q.write_pointer == 0);
Expand Down Expand Up @@ -102,7 +102,7 @@ TEST_CASE("msgq_msg_send test wraparound")
{
remove("/dev/shm/test_queue");
msgq_queue_t q;
msgq_new_queue(&q, "test_queue", 1024);
msgq_new_queue_pub(&q, "test_queue", 1024);
msgq_init_publisher(&q);

REQUIRE((*q.write_pointer & 0xFFFFFFFF) == 0);
Expand Down Expand Up @@ -134,8 +134,8 @@ TEST_CASE("msgq_msg_recv test wraparound")
{
remove("/dev/shm/test_queue");
msgq_queue_t q_pub, q_sub;
msgq_new_queue(&q_pub, "test_queue", 1024);
msgq_new_queue(&q_sub, "test_queue", 1024);
msgq_new_queue_pub(&q_pub, "test_queue", 1024);
msgq_new_queue_sub(&q_sub, "test_queue", 1024);

msgq_init_publisher(&q_pub);
msgq_init_subscriber(&q_sub);
Expand Down Expand Up @@ -180,8 +180,8 @@ TEST_CASE("msgq_msg_send test invalidation")
{
remove("/dev/shm/test_queue");
msgq_queue_t q_pub, q_sub;
msgq_new_queue(&q_pub, "test_queue", 1024);
msgq_new_queue(&q_sub, "test_queue", 1024);
msgq_new_queue_pub(&q_pub, "test_queue", 1024);
msgq_new_queue_sub(&q_sub, "test_queue", 1024);

msgq_init_publisher(&q_pub);
msgq_init_subscriber(&q_sub);
Expand Down Expand Up @@ -216,8 +216,8 @@ TEST_CASE("msgq_init_subscriber init 2 subscribers")
{
remove("/dev/shm/test_queue");
msgq_queue_t q1, q2;
msgq_new_queue(&q1, "test_queue", 1024);
msgq_new_queue(&q2, "test_queue", 1024);
msgq_new_queue_sub(&q1, "test_queue", 1024);
msgq_new_queue_sub(&q2, "test_queue", 1024);

*q1.num_readers = 0;

Expand All @@ -241,8 +241,8 @@ TEST_CASE("Write 1 msg, read 1 msg", "[integration]")
const size_t msg_size = 128;
msgq_queue_t writer, reader;

msgq_new_queue(&writer, "test_queue", 1024);
msgq_new_queue(&reader, "test_queue", 1024);
msgq_new_queue_pub(&writer, "test_queue", 1024);
msgq_new_queue_sub(&reader, "test_queue", 1024);

msgq_init_publisher(&writer);
msgq_init_subscriber(&reader);
Expand Down Expand Up @@ -277,8 +277,8 @@ TEST_CASE("Write 2 msg, read 2 msg - conflate = false", "[integration]")
const size_t msg_size = 128;
msgq_queue_t writer, reader;

msgq_new_queue(&writer, "test_queue", 1024);
msgq_new_queue(&reader, "test_queue", 1024);
msgq_new_queue_pub(&writer, "test_queue", 1024);
msgq_new_queue_sub(&reader, "test_queue", 1024);

msgq_init_publisher(&writer);
msgq_init_subscriber(&reader);
Expand Down Expand Up @@ -314,8 +314,8 @@ TEST_CASE("Write 2 msg, read 2 msg - conflate = true", "[integration]")
const size_t msg_size = 128;
msgq_queue_t writer, reader;

msgq_new_queue(&writer, "test_queue", 1024);
msgq_new_queue(&reader, "test_queue", 1024);
msgq_new_queue_pub(&writer, "test_queue", 1024);
msgq_new_queue_sub(&reader, "test_queue", 1024);

msgq_init_publisher(&writer);
msgq_init_subscriber(&reader);
Expand Down Expand Up @@ -351,8 +351,8 @@ TEST_CASE("1 publisher, 1 slow subscriber", "[integration]")
remove("/dev/shm/test_queue");
msgq_queue_t writer, reader;

msgq_new_queue(&writer, "test_queue", 1024);
msgq_new_queue(&reader, "test_queue", 1024);
msgq_new_queue_pub(&writer, "test_queue", 1024);
msgq_new_queue_sub(&reader, "test_queue", 1024);

msgq_init_publisher(&writer);
msgq_init_subscriber(&reader);
Expand Down Expand Up @@ -394,9 +394,9 @@ TEST_CASE("1 publisher, 2 subscribers", "[integration]")
remove("/dev/shm/test_queue");
msgq_queue_t writer, reader1, reader2;

msgq_new_queue(&writer, "test_queue", 1024);
msgq_new_queue(&reader1, "test_queue", 1024);
msgq_new_queue(&reader2, "test_queue", 1024);
msgq_new_queue_pub(&writer, "test_queue", 1024);
msgq_new_queue_sub(&reader1, "test_queue", 1024);
msgq_new_queue_sub(&reader2, "test_queue", 1024);

msgq_init_publisher(&writer);
msgq_init_subscriber(&reader1);
Expand Down

0 comments on commit 444d22f

Please sign in to comment.