aboutsummaryrefslogtreecommitdiffstats
path: root/tests/llc
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-15 11:05:44 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-22 10:39:06 +0200
commit07eb655244bd973a9bdf69ef958ee06cf867a0bb (patch)
treeb8755ad7d75edf67161f16560b702c0d31ba1c8c /tests/llc
parent1eae96ca2fe1e23def798ea90645538a4e4193e5 (diff)
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
Diffstat (limited to 'tests/llc')
-rw-r--r--tests/llc/LlcTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/llc/LlcTest.cpp b/tests/llc/LlcTest.cpp
index 9e1d35d0..5cc6e6e0 100644
--- a/tests/llc/LlcTest.cpp
+++ b/tests/llc/LlcTest.cpp
@@ -102,24 +102,31 @@ static void test_llc_queue()
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__);
}