llc: Keep track of the number of stored LLC octets
To get the number of LLC octets that are stored in the queue, this
commit adds a m_queue_octets member along with a octets() method.
This value is updated similarly to m_queue_size on each modifying
method call.
Sponsored-by: On-Waves ehf
diff --git a/tests/llc/LlcTest.cpp b/tests/llc/LlcTest.cpp
index 9e1d35d..5cc6e6e 100644
--- a/tests/llc/LlcTest.cpp
+++ b/tests/llc/LlcTest.cpp
@@ -102,24 +102,31 @@
queue.init();
OSMO_ASSERT(queue.size() == 0);
+ OSMO_ASSERT(queue.octets() == 0);
enqueue_data(&queue, "LLC message");
OSMO_ASSERT(queue.size() == 1);
+ OSMO_ASSERT(queue.octets() == 11);
enqueue_data(&queue, "other LLC message");
OSMO_ASSERT(queue.size() == 2);
+ OSMO_ASSERT(queue.octets() == 28);
dequeue_and_check(&queue, "LLC message");
OSMO_ASSERT(queue.size() == 1);
+ OSMO_ASSERT(queue.octets() == 17);
dequeue_and_check(&queue, "other LLC message");
OSMO_ASSERT(queue.size() == 0);
+ OSMO_ASSERT(queue.octets() == 0);
enqueue_data(&queue, "LLC");
OSMO_ASSERT(queue.size() == 1);
+ OSMO_ASSERT(queue.octets() == 3);
queue.clear(NULL);
OSMO_ASSERT(queue.size() == 0);
+ OSMO_ASSERT(queue.octets() == 0);
printf("=== end %s ===\n", __func__);
}