Update the MessageQueue and add unit test for it. (#1089)

This commit makes the following changes:

- It adds a unit test for testing different `MessageQueue` operations.

- It modifies how the `MessageQueue` determines the lists (the `kListAll`
  is maintained by the message pool and the `kListInterface` is accessed
  from the `MessageQueue` associated with the list).

- It modifies the underlying list implementation to use a circular doubly
  linked-list.
This commit is contained in:
Abtin Keshavarzian
2016-12-20 08:46:58 -08:00
committed by Jonathan Hui
parent 97fbca2063
commit 9d3bd7802b
8 changed files with 303 additions and 112 deletions
+9 -3
View File
@@ -65,6 +65,9 @@ namespace Thread
// test_message.cpp
void TestMessage();
// test_message_queue.cpp
void TestMessageQueue();
// test_ncp_buffer.cpp
namespace Thread
{
@@ -92,7 +95,7 @@ utAssertTrue s_AssertTrue;
utLogMessage s_LogMessage;
namespace Thread
{
{
TEST_CLASS(UnitTests)
{
public:
@@ -114,7 +117,7 @@ namespace Thread
va_start(args, format);
vsnprintf(message, sizeof(message), format, args);
va_end(args);
Logger::WriteMessage(message);
}
@@ -145,7 +148,10 @@ namespace Thread
// test_message.cpp
TEST_METHOD(TestMessage) { ::TestMessage(); }
// test_message.cpp
// test_message_queue.cpp
TEST_METHOD(TestMessageQueue) { ::TestMessageQueue(); }
// test_timer.cpp
TEST_METHOD(TestOneTimer) { ::TestOneTimer(); }
TEST_METHOD(TestTenTimers) { ::TestTenTimers(); }