{"action":"created","comment":{"url":"https://api.github.com/repos/openthread/openthread/pulls/comments/93108454","pull_request_review_id":13630487,"id":93108454,"diff_hunk":"@@ -0,0 +1,141 @@\n+/*\n+ *  Copyright (c) 2016, The OpenThread Authors.\n+ *  All rights reserved.\n+ *\n+ *  Redistribution and use in source and binary forms, with or without\n+ *  modification, are permitted provided that the following conditions are met:\n+ *  1. Redistributions of source code must retain the above copyright\n+ *     notice, this list of conditions and the following disclaimer.\n+ *  2. Redistributions in binary form must reproduce the above copyright\n+ *     notice, this list of conditions and the following disclaimer in the\n+ *     documentation and/or other materials provided with the distribution.\n+ *  3. Neither the name of the copyright holder nor the\n+ *     names of its contributors may be used to endorse or promote products\n+ *     derived from this software without specific prior written permission.\n+ *\n+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+ *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+ *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+ *  POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include \"test_util.h\"\n+#include <openthread.h>\n+#include <common/debug.hpp>\n+#include <common/message.hpp>\n+#include <string.h>\n+#include <stdarg.h>\n+\n+#define kNumMessages      5\n+\n+// This function verifies the content of the message to matches the passed in messages\n+void VerifyMessageQueueContent(Thread::MessageQueue &aMessageQueue, int aExpectedLength, ...)\n+{\n+    va_list args;\n+    Thread::Message *message;\n+    Thread::Message *msgArg;\n+\n+    va_start(args, aExpectedLength);\n+\n+    if (aExpectedLength == 0)\n+    {\n+        message = aMessageQueue.GetHead();\n+        VerifyOrQuit(message == NULL, \"MessageQueue is not empty when expected len is zero.\");\n+    }\n+    else\n+    {\n+        for (message = aMessageQueue.GetHead(); message != NULL; message = message->GetNext())\n+        {\n+            VerifyOrQuit(aExpectedLength != 0, \"MessageQueue contains more entries than expected\");\n+\n+            msgArg = va_arg(args, Thread::Message *);\n+            VerifyOrQuit(msgArg == message, \"MessageQueue content does not match what is expected.\");\n+\n+            aExpectedLength--;\n+        }\n+\n+        VerifyOrQuit(aExpectedLength == 0, \"MessageQueue contains less entries than expected\");\n+    }\n+\n+    va_end(args);\n+}\n+\n+void TestMessageQueue(void)","path":"tests/unit/test_message_queue.cpp","position":70,"original_position":70,"commit_id":"2a94622d6768df484b25d00e6d5a96a209344917","original_commit_id":"2a94622d6768df484b25d00e6d5a96a209344917","user":{"login":"nibanks","id":20663557,"avatar_url":"https://avatars.githubusercontent.com/u/20663557?v=3","gravatar_id":"","url":"https://api.github.com/users/nibanks","html_url":"https://github.com/nibanks","followers_url":"https://api.github.com/users/nibanks/followers","following_url":"https://api.github.com/users/nibanks/following{/other_user}","gists_url":"https://api.github.com/users/nibanks/gists{/gist_id}","starred_url":"https://api.github.com/users/nibanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nibanks/subscriptions","organizations_url":"https://api.github.com/users/nibanks/orgs","repos_url":"https://api.github.com/users/nibanks/repos","events_url":"https://api.github.com/users/nibanks/events{/privacy}","received_events_url":"https://api.github.com/users/nibanks/received_events","type":"User","site_admin":false},"body":"It's really pretty simple to add to Windows. #1037 is a good example. Essentially:\r\n\r\n- Add a `ClCompile` to `etc/visual-studio/UnitTests.vcxproj` for the new file you added\r\n\r\n- Add the function declaration and test caller to `tests/unit/test_windows.cpp`","created_at":"2016-12-19T20:03:11Z","updated_at":"2016-12-19T20:03:12Z","html_url":"https://github.com/openthread/openthread/pull/1089#discussion_r93108454","pull_request_url":"https://api.github.com/repos/openthread/openthread/pulls/1089","_links":{"self":{"href":"https://api.github.com/repos/openthread/openthread/pulls/comments/93108454"},"html":{"href":"https://github.com/openthread/openthread/pull/1089#discussion_r93108454"},"pull_request":{"href":"https://api.github.com/repos/openthread/openthread/pulls/1089"}}},"pull_request":{"url":"https://api.github.com/repos/openthread/openthread/pulls/1089","id":98618887,"html_url":"https://github.com/openthread/openthread/pull/1089","diff_url":"https://github.com/openthread/openthread/pull/1089.diff","patch_url":"https://github.com/openthread/openthread/pull/1089.patch","issue_url":"https://api.github.com/repos/openthread/openthread/issues/1089","number":1089,"state":"open","locked":false,"title":"Update the `MessageQueue` and add unit test for it.","user":{"login":"abtink","id":17729664,"avatar_url":"https://avatars.githubusercontent.com/u/17729664?v=3","gravatar_id":"","url":"https://api.github.com/users/abtink","html_url":"https://github.com/abtink","followers_url":"https://api.github.com/users/abtink/followers","following_url":"https://api.github.com/users/abtink/following{/other_user}","gists_url":"https://api.github.com/users/abtink/gists{/gist_id}","starred_url":"https://api.github.com/users/abtink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abtink/subscriptions","organizations_url":"https://api.github.com/users/abtink/orgs","repos_url":"https://api.github.com/users/abtink/repos","events_url":"https://api.github.com/users/abtink/events{/privacy}","received_events_url":"https://api.github.com/users/abtink/received_events","type":"User","site_admin":false},"body":"This commit makes the following changes:\r\n\r\n- It adds a unit test for testing different `MessageQueue` operations.\r\n\r\n- It modifies how the `MessageQueue`/`Message` store/determine the lists (the `kListAll`  is maintained by the message pool and the `kListInterface` is accessed  from the `MessageQueue` associated with the `Message`).\r\n\r\n- It modifies the underlying list implementation to use a _circular_ doubly  linked-list. \r\n\r\nThese changes are indirectly related to Issue https://github.com/openthread/openthread/issues/1047 (preparing to add `Priority` level to `Message`s and a priority queue implementation compatible with current `MessageQueue`).\r\n","created_at":"2016-12-19T18:49:45Z","updated_at":"2016-12-19T20:03:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d641204fc0f50fb87d74e46fcb1f95456c98a34c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openthread/openthread/pulls/1089/commits","review_comments_url":"https://api.github.com/repos/openthread/openthread/pulls/1089/comments","review_comment_url":"https://api.github.com/repos/openthread/openthread/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openthread/openthread/issues/1089/comments","statuses_url":"https://api.github.com/repos/openthread/openthread/statuses/2a94622d6768df484b25d00e6d5a96a209344917","head":{"label":"abtink:usr/abtink/change-msg-queue","ref":"usr/abtink/change-msg-queue","sha":"2a94622d6768df484b25d00e6d5a96a209344917","user":{"login":"abtink","id":17729664,"avatar_url":"https://avatars.githubusercontent.com/u/17729664?v=3","gravatar_id":"","url":"https://api.github.com/users/abtink","html_url":"https://github.com/abtink","followers_url":"https://api.github.com/users/abtink/followers","following_url":"https://api.github.com/users/abtink/following{/other_user}","gists_url":"https://api.github.com/users/abtink/gists{/gist_id}","starred_url":"https://api.github.com/users/abtink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abtink/subscriptions","organizations_url":"https://api.github.com/users/abtink/orgs","repos_url":"https://api.github.com/users/abtink/repos","events_url":"https://api.github.com/users/abtink/events{/privacy}","received_events_url":"https://api.github.com/users/abtink/received_events","type":"User","site_admin":false},"repo":{"id":60545666,"name":"openthread","full_name":"abtink/openthread","owner":{"login":"abtink","id":17729664,"avatar_url":"https://avatars.githubusercontent.com/u/17729664?v=3","gravatar_id":"","url":"https://api.github.com/users/abtink","html_url":"https://github.com/abtink","followers_url":"https://api.github.com/users/abtink/followers","following_url":"https://api.github.com/users/abtink/following{/other_user}","gists_url":"https://api.github.com/users/abtink/gists{/gist_id}","starred_url":"https://api.github.com/users/abtink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abtink/subscriptions","organizations_url":"https://api.github.com/users/abtink/orgs","repos_url":"https://api.github.com/users/abtink/repos","events_url":"https://api.github.com/users/abtink/events{/privacy}","received_events_url":"https://api.github.com/users/abtink/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abtink/openthread","description":"OpenThread released by Nest is an open-source implementation of the Thread networking protocol","fork":true,"url":"https://api.github.com/repos/abtink/openthread","forks_url":"https://api.github.com/repos/abtink/openthread/forks","keys_url":"https://api.github.com/repos/abtink/openthread/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abtink/openthread/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abtink/openthread/teams","hooks_url":"https://api.github.com/repos/abtink/openthread/hooks","issue_events_url":"https://api.github.com/repos/abtink/openthread/issues/events{/number}","events_url":"https://api.github.com/repos/abtink/openthread/events","assignees_url":"https://api.github.com/repos/abtink/openthread/assignees{/user}","branches_url":"https://api.github.com/repos/abtink/openthread/branches{/branch}","tags_url":"https://api.github.com/repos/abtink/openthread/tags","blobs_url":"https://api.github.com/repos/abtink/openthread/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abtink/openthread/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abtink/openthread/git/refs{/sha}","trees_url":"https://api.github.com/repos/abtink/openthread/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abtink/openthread/statuses/{sha}","languages_url":"https://api.github.com/repos/abtink/openthread/languages","stargazers_url":"https://api.github.com/repos/abtink/openthread/stargazers","contributors_url":"https://api.github.com/repos/abtink/openthread/contributors","subscribers_url":"https://api.github.com/repos/abtink/openthread/subscribers","subscription_url":"https://api.github.com/repos/abtink/openthread/subscription","commits_url":"https://api.github.com/repos/abtink/openthread/commits{/sha}","git_commits_url":"https://api.github.com/repos/abtink/openthread/git/commits{/sha}","comments_url":"https://api.github.com/repos/abtink/openthread/comments{/number}","issue_comment_url":"https://api.github.com/repos/abtink/openthread/issues/comments{/number}","contents_url":"https://api.github.com/repos/abtink/openthread/contents/{+path}","compare_url":"https://api.github.com/repos/abtink/openthread/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abtink/openthread/merges","archive_url":"https://api.github.com/repos/abtink/openthread/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abtink/openthread/downloads","issues_url":"https://api.github.com/repos/abtink/openthread/issues{/number}","pulls_url":"https://api.github.com/repos/abtink/openthread/pulls{/number}","milestones_url":"https://api.github.com/repos/abtink/openthread/milestones{/number}","notifications_url":"https://api.github.com/repos/abtink/openthread/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abtink/openthread/labels{/name}","releases_url":"https://api.github.com/repos/abtink/openthread/releases{/id}","deployments_url":"https://api.github.com/repos/abtink/openthread/deployments","created_at":"2016-06-06T17:04:09Z","updated_at":"2016-10-22T15:04:31Z","pushed_at":"2016-12-19T18:29:04Z","git_url":"git://github.com/abtink/openthread.git","ssh_url":"git@github.com:abtink/openthread.git","clone_url":"https://github.com/abtink/openthread.git","svn_url":"https://github.com/abtink/openthread","homepage":"","size":96305,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openthread:master","ref":"master","sha":"bab5c2600497a7f4462a8a54a5af9ce649c29d52","user":{"login":"openthread","id":16142269,"avatar_url":"https://avatars.githubusercontent.com/u/16142269?v=3","gravatar_id":"","url":"https://api.github.com/users/openthread","html_url":"https://github.com/openthread","followers_url":"https://api.github.com/users/openthread/followers","following_url":"https://api.github.com/users/openthread/following{/other_user}","gists_url":"https://api.github.com/users/openthread/gists{/gist_id}","starred_url":"https://api.github.com/users/openthread/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openthread/subscriptions","organizations_url":"https://api.github.com/users/openthread/orgs","repos_url":"https://api.github.com/users/openthread/repos","events_url":"https://api.github.com/users/openthread/events{/privacy}","received_events_url":"https://api.github.com/users/openthread/received_events","type":"Organization","site_admin":false},"repo":{"id":55808787,"name":"openthread","full_name":"openthread/openthread","owner":{"login":"openthread","id":16142269,"avatar_url":"https://avatars.githubusercontent.com/u/16142269?v=3","gravatar_id":"","url":"https://api.github.com/users/openthread","html_url":"https://github.com/openthread","followers_url":"https://api.github.com/users/openthread/followers","following_url":"https://api.github.com/users/openthread/following{/other_user}","gists_url":"https://api.github.com/users/openthread/gists{/gist_id}","starred_url":"https://api.github.com/users/openthread/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openthread/subscriptions","organizations_url":"https://api.github.com/users/openthread/orgs","repos_url":"https://api.github.com/users/openthread/repos","events_url":"https://api.github.com/users/openthread/events{/privacy}","received_events_url":"https://api.github.com/users/openthread/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openthread/openthread","description":"OpenThread released by Nest is an open-source implementation of the Thread networking protocol","fork":false,"url":"https://api.github.com/repos/openthread/openthread","forks_url":"https://api.github.com/repos/openthread/openthread/forks","keys_url":"https://api.github.com/repos/openthread/openthread/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openthread/openthread/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openthread/openthread/teams","hooks_url":"https://api.github.com/repos/openthread/openthread/hooks","issue_events_url":"https://api.github.com/repos/openthread/openthread/issues/events{/number}","events_url":"https://api.github.com/repos/openthread/openthread/events","assignees_url":"https://api.github.com/repos/openthread/openthread/assignees{/user}","branches_url":"https://api.github.com/repos/openthread/openthread/branches{/branch}","tags_url":"https://api.github.com/repos/openthread/openthread/tags","blobs_url":"https://api.github.com/repos/openthread/openthread/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openthread/openthread/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openthread/openthread/git/refs{/sha}","trees_url":"https://api.github.com/repos/openthread/openthread/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openthread/openthread/statuses/{sha}","languages_url":"https://api.github.com/repos/openthread/openthread/languages","stargazers_url":"https://api.github.com/repos/openthread/openthread/stargazers","contributors_url":"https://api.github.com/repos/openthread/openthread/contributors","subscribers_url":"https://api.github.com/repos/openthread/openthread/subscribers","subscription_url":"https://api.github.com/repos/openthread/openthread/subscription","commits_url":"https://api.github.com/repos/openthread/openthread/commits{/sha}","git_commits_url":"https://api.github.com/repos/openthread/openthread/git/commits{/sha}","comments_url":"https://api.github.com/repos/openthread/openthread/comments{/number}","issue_comment_url":"https://api.github.com/repos/openthread/openthread/issues/comments{/number}","contents_url":"https://api.github.com/repos/openthread/openthread/contents/{+path}","compare_url":"https://api.github.com/repos/openthread/openthread/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openthread/openthread/merges","archive_url":"https://api.github.com/repos/openthread/openthread/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openthread/openthread/downloads","issues_url":"https://api.github.com/repos/openthread/openthread/issues{/number}","pulls_url":"https://api.github.com/repos/openthread/openthread/pulls{/number}","milestones_url":"https://api.github.com/repos/openthread/openthread/milestones{/number}","notifications_url":"https://api.github.com/repos/openthread/openthread/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openthread/openthread/labels{/name}","releases_url":"https://api.github.com/repos/openthread/openthread/releases{/id}","deployments_url":"https://api.github.com/repos/openthread/openthread/deployments","created_at":"2016-04-08T20:47:41Z","updated_at":"2016-12-19T01:22:06Z","pushed_at":"2016-12-19T18:49:45Z","git_url":"git://github.com/openthread/openthread.git","ssh_url":"git@github.com:openthread/openthread.git","clone_url":"https://github.com/openthread/openthread.git","svn_url":"https://github.com/openthread/openthread","homepage":"","size":556265,"stargazers_count":1066,"watchers_count":1066,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":245,"mirror_url":null,"open_issues_count":32,"forks":245,"open_issues":32,"watchers":1066,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openthread/openthread/pulls/1089"},"html":{"href":"https://github.com/openthread/openthread/pull/1089"},"issue":{"href":"https://api.github.com/repos/openthread/openthread/issues/1089"},"comments":{"href":"https://api.github.com/repos/openthread/openthread/issues/1089/comments"},"review_comments":{"href":"https://api.github.com/repos/openthread/openthread/pulls/1089/comments"},"review_comment":{"href":"https://api.github.com/repos/openthread/openthread/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openthread/openthread/pulls/1089/commits"},"statuses":{"href":"https://api.github.com/repos/openthread/openthread/statuses/2a94622d6768df484b25d00e6d5a96a209344917"}}}}
{"actor":{"display_login":"nibanks"}}