|
|
@ -587,7 +587,7 @@ int uORBTest::UnitTest::test_queue() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int queue_size = 11; |
|
|
|
const unsigned int queue_size = 11; |
|
|
|
t.val = 0; |
|
|
|
t.val = 0; |
|
|
|
ptopic = orb_advertise_queue(ORB_ID(orb_test_medium_queue), &t, queue_size); |
|
|
|
ptopic = orb_advertise_queue(ORB_ID(orb_test_medium_queue), &t, queue_size); |
|
|
|
|
|
|
|
|
|
|
@ -635,12 +635,12 @@ int uORBTest::UnitTest::test_queue() |
|
|
|
|
|
|
|
|
|
|
|
test_note(" Testing to write some elements..."); |
|
|
|
test_note(" Testing to write some elements..."); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < queue_size - 2; ++i) { |
|
|
|
for (unsigned int i = 0; i < queue_size - 2; ++i) { |
|
|
|
t.val = i; |
|
|
|
t.val = i; |
|
|
|
orb_publish(ORB_ID(orb_test_medium_queue), ptopic, &t); |
|
|
|
orb_publish(ORB_ID(orb_test_medium_queue), ptopic, &t); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < queue_size - 2; ++i) { |
|
|
|
for (unsigned int i = 0; i < queue_size - 2; ++i) { |
|
|
|
CHECK_UPDATED(i); |
|
|
|
CHECK_UPDATED(i); |
|
|
|
CHECK_COPY(u.val, i); |
|
|
|
CHECK_COPY(u.val, i); |
|
|
|
} |
|
|
|
} |
|
|
@ -650,12 +650,12 @@ int uORBTest::UnitTest::test_queue() |
|
|
|
test_note(" Testing overflow..."); |
|
|
|
test_note(" Testing overflow..."); |
|
|
|
int overflow_by = 3; |
|
|
|
int overflow_by = 3; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < queue_size + overflow_by; ++i) { |
|
|
|
for (unsigned int i = 0; i < queue_size + overflow_by; ++i) { |
|
|
|
t.val = i; |
|
|
|
t.val = i; |
|
|
|
orb_publish(ORB_ID(orb_test_medium_queue), ptopic, &t); |
|
|
|
orb_publish(ORB_ID(orb_test_medium_queue), ptopic, &t); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < queue_size; ++i) { |
|
|
|
for (unsigned int i = 0; i < queue_size; ++i) { |
|
|
|
CHECK_UPDATED(i); |
|
|
|
CHECK_UPDATED(i); |
|
|
|
CHECK_COPY(u.val, i + overflow_by); |
|
|
|
CHECK_COPY(u.val, i + overflow_by); |
|
|
|
} |
|
|
|
} |
|
|
@ -664,7 +664,7 @@ int uORBTest::UnitTest::test_queue() |
|
|
|
|
|
|
|
|
|
|
|
test_note(" Testing underflow..."); |
|
|
|
test_note(" Testing underflow..."); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < queue_size; ++i) { |
|
|
|
for (unsigned int i = 0; i < queue_size; ++i) { |
|
|
|
CHECK_NOT_UPDATED(i); |
|
|
|
CHECK_NOT_UPDATED(i); |
|
|
|
CHECK_COPY(u.val, queue_size + overflow_by - 1); |
|
|
|
CHECK_COPY(u.val, queue_size + overflow_by - 1); |
|
|
|
} |
|
|
|
} |
|
|
@ -694,7 +694,7 @@ int uORBTest::UnitTest::pub_test_queue_main() |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct orb_test_medium t; |
|
|
|
struct orb_test_medium t; |
|
|
|
orb_advert_t ptopic; |
|
|
|
orb_advert_t ptopic; |
|
|
|
const int queue_size = 50; |
|
|
|
const unsigned int queue_size = 50; |
|
|
|
t.val = 0; |
|
|
|
t.val = 0; |
|
|
|
|
|
|
|
|
|
|
|
if ((ptopic = orb_advertise_queue(ORB_ID(orb_test_medium_queue_poll), &t, queue_size)) == nullptr) { |
|
|
|
if ((ptopic = orb_advertise_queue(ORB_ID(orb_test_medium_queue_poll), &t, queue_size)) == nullptr) { |
|
|
|