{"action":"created","comment":{"url":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/comments/56532648","id":56532648,"diff_hunk":"@@ -0,0 +1,151 @@\n+/*\n+ * PackageLicenseDeclared: Apache-2.0\n+ * Copyright (c) 2015 ARM Limited\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/* @file main.cpp\n+ *\n+ * This test suite tests scenarios to reset target in-between the test.\n+ *\n+ *   The following tests are implemented in this file:\n+ *     Test 1            Reset target inbetween the tests.\n+ */\n+\n+#include \"greentea-client/test_env.h\"\n+#include \"utest/utest.h\"\n+#include \"unity/unity.h\"\n+\n+#include \"mbed-drivers/mbed.h\"\n+\n+#include <algorithm>\n+#include <cstdlib>\n+\n+using namespace utest::v1;\n+\n+/** Custom echo test\n+ * \n+ *  This function sends key,value pairs like {{echo;n}}. Where n is a number.\n+ *  Host replies back with {{echo;m*n}}. Where m is a multiplier both target\n+ *  and host know based on the target state.\n+ *\n+ *        state     multiplier\n+ *          0           1\n+ *          1           2\n+ *\n+ *  Response is asserted to verify the state based execution of both host\n+ *  and target before and after reset.\n+ */\n+void do_echo_test(int response_multiplier)\n+{\n+    char key[] = \"echo\";\n+    char data[] = \"10\";\n+\n+    for (int i =0; i < 10; i++)\n+    {\n+        snprintf(data, sizeof(data), \"%d\", i);\n+        greentea_send_kv(\"echo\", data);","path":"test/reset/main.cpp","position":58,"original_position":58,"commit_id":"cc20c7ae1f048b6a84c18590254105fba0702163","original_commit_id":"cc20c7ae1f048b6a84c18590254105fba0702163","user":{"login":"PrzemekWirkus","id":6360720,"avatar_url":"https://avatars.githubusercontent.com/u/6360720?v=3","gravatar_id":"","url":"https://api.github.com/users/PrzemekWirkus","html_url":"https://github.com/PrzemekWirkus","followers_url":"https://api.github.com/users/PrzemekWirkus/followers","following_url":"https://api.github.com/users/PrzemekWirkus/following{/other_user}","gists_url":"https://api.github.com/users/PrzemekWirkus/gists{/gist_id}","starred_url":"https://api.github.com/users/PrzemekWirkus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrzemekWirkus/subscriptions","organizations_url":"https://api.github.com/users/PrzemekWirkus/orgs","repos_url":"https://api.github.com/users/PrzemekWirkus/repos","events_url":"https://api.github.com/users/PrzemekWirkus/events{/privacy}","received_events_url":"https://api.github.com/users/PrzemekWirkus/received_events","type":"User","site_admin":false},"body":"There is a:\r\n```c++\r\ngreentea_send_kv(const char*, int);\r\n```\r\nfunction, no need to convert to string.\r\n","created_at":"2016-03-17T16:21:20Z","updated_at":"2016-03-17T16:21:20Z","html_url":"https://github.com/ARMmbed/greentea-client/pull/8#discussion_r56532648","pull_request_url":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/comments/56532648"},"html":{"href":"https://github.com/ARMmbed/greentea-client/pull/8#discussion_r56532648"},"pull_request":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8","id":62945000,"html_url":"https://github.com/ARMmbed/greentea-client/pull/8","diff_url":"https://github.com/ARMmbed/greentea-client/pull/8.diff","patch_url":"https://github.com/ARMmbed/greentea-client/pull/8.patch","issue_url":"https://api.github.com/repos/ARMmbed/greentea-client/issues/8","number":8,"state":"open","locked":false,"title":"Test to demo target reset in test","user":{"login":"mazimkhan","id":13520658,"avatar_url":"https://avatars.githubusercontent.com/u/13520658?v=3","gravatar_id":"","url":"https://api.github.com/users/mazimkhan","html_url":"https://github.com/mazimkhan","followers_url":"https://api.github.com/users/mazimkhan/followers","following_url":"https://api.github.com/users/mazimkhan/following{/other_user}","gists_url":"https://api.github.com/users/mazimkhan/gists{/gist_id}","starred_url":"https://api.github.com/users/mazimkhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mazimkhan/subscriptions","organizations_url":"https://api.github.com/users/mazimkhan/orgs","repos_url":"https://api.github.com/users/mazimkhan/repos","events_url":"https://api.github.com/users/mazimkhan/events{/privacy}","received_events_url":"https://api.github.com/users/mazimkhan/received_events","type":"User","site_admin":false},"body":"Test to demo DUT reset in a test and manage test state.\r\n\r\nThis test kicks off the host test by sending {{start;}}\r\nThen receives state from host as {{state;x}}. Where it should be x=0 on first start and 1\r\nafter reset.\r\nAt the end of first iteration it asks host test to reset the target.\r\nIn both before and after iterations it runs an echo test. It verifies the echoes based\r\non a multiplier known to both target and host test code based on the target state.\r\n\r\n        state     multiplier\r\n          0           1\r\n          1           2\r\n\r\n","created_at":"2016-03-15T17:26:04Z","updated_at":"2016-03-17T16:21:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95616f455496c9956ad402fcda6dadc96f30745c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8/commits","review_comments_url":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8/comments","review_comment_url":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARMmbed/greentea-client/issues/8/comments","statuses_url":"https://api.github.com/repos/ARMmbed/greentea-client/statuses/cc20c7ae1f048b6a84c18590254105fba0702163","head":{"label":"mazimkhan:master","ref":"master","sha":"cc20c7ae1f048b6a84c18590254105fba0702163","user":{"login":"mazimkhan","id":13520658,"avatar_url":"https://avatars.githubusercontent.com/u/13520658?v=3","gravatar_id":"","url":"https://api.github.com/users/mazimkhan","html_url":"https://github.com/mazimkhan","followers_url":"https://api.github.com/users/mazimkhan/followers","following_url":"https://api.github.com/users/mazimkhan/following{/other_user}","gists_url":"https://api.github.com/users/mazimkhan/gists{/gist_id}","starred_url":"https://api.github.com/users/mazimkhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mazimkhan/subscriptions","organizations_url":"https://api.github.com/users/mazimkhan/orgs","repos_url":"https://api.github.com/users/mazimkhan/repos","events_url":"https://api.github.com/users/mazimkhan/events{/privacy}","received_events_url":"https://api.github.com/users/mazimkhan/received_events","type":"User","site_admin":false},"repo":{"id":53863332,"name":"greentea-client","full_name":"mazimkhan/greentea-client","owner":{"login":"mazimkhan","id":13520658,"avatar_url":"https://avatars.githubusercontent.com/u/13520658?v=3","gravatar_id":"","url":"https://api.github.com/users/mazimkhan","html_url":"https://github.com/mazimkhan","followers_url":"https://api.github.com/users/mazimkhan/followers","following_url":"https://api.github.com/users/mazimkhan/following{/other_user}","gists_url":"https://api.github.com/users/mazimkhan/gists{/gist_id}","starred_url":"https://api.github.com/users/mazimkhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mazimkhan/subscriptions","organizations_url":"https://api.github.com/users/mazimkhan/orgs","repos_url":"https://api.github.com/users/mazimkhan/repos","events_url":"https://api.github.com/users/mazimkhan/events{/privacy}","received_events_url":"https://api.github.com/users/mazimkhan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mazimkhan/greentea-client","description":"DUT's (device under test) side of Greentea","fork":true,"url":"https://api.github.com/repos/mazimkhan/greentea-client","forks_url":"https://api.github.com/repos/mazimkhan/greentea-client/forks","keys_url":"https://api.github.com/repos/mazimkhan/greentea-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mazimkhan/greentea-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mazimkhan/greentea-client/teams","hooks_url":"https://api.github.com/repos/mazimkhan/greentea-client/hooks","issue_events_url":"https://api.github.com/repos/mazimkhan/greentea-client/issues/events{/number}","events_url":"https://api.github.com/repos/mazimkhan/greentea-client/events","assignees_url":"https://api.github.com/repos/mazimkhan/greentea-client/assignees{/user}","branches_url":"https://api.github.com/repos/mazimkhan/greentea-client/branches{/branch}","tags_url":"https://api.github.com/repos/mazimkhan/greentea-client/tags","blobs_url":"https://api.github.com/repos/mazimkhan/greentea-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mazimkhan/greentea-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mazimkhan/greentea-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/mazimkhan/greentea-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mazimkhan/greentea-client/statuses/{sha}","languages_url":"https://api.github.com/repos/mazimkhan/greentea-client/languages","stargazers_url":"https://api.github.com/repos/mazimkhan/greentea-client/stargazers","contributors_url":"https://api.github.com/repos/mazimkhan/greentea-client/contributors","subscribers_url":"https://api.github.com/repos/mazimkhan/greentea-client/subscribers","subscription_url":"https://api.github.com/repos/mazimkhan/greentea-client/subscription","commits_url":"https://api.github.com/repos/mazimkhan/greentea-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/mazimkhan/greentea-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/mazimkhan/greentea-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/mazimkhan/greentea-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/mazimkhan/greentea-client/contents/{+path}","compare_url":"https://api.github.com/repos/mazimkhan/greentea-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mazimkhan/greentea-client/merges","archive_url":"https://api.github.com/repos/mazimkhan/greentea-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mazimkhan/greentea-client/downloads","issues_url":"https://api.github.com/repos/mazimkhan/greentea-client/issues{/number}","pulls_url":"https://api.github.com/repos/mazimkhan/greentea-client/pulls{/number}","milestones_url":"https://api.github.com/repos/mazimkhan/greentea-client/milestones{/number}","notifications_url":"https://api.github.com/repos/mazimkhan/greentea-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mazimkhan/greentea-client/labels{/name}","releases_url":"https://api.github.com/repos/mazimkhan/greentea-client/releases{/id}","deployments_url":"https://api.github.com/repos/mazimkhan/greentea-client/deployments","created_at":"2016-03-14T14:31:14Z","updated_at":"2016-03-14T14:31:15Z","pushed_at":"2016-03-15T17:18:38Z","git_url":"git://github.com/mazimkhan/greentea-client.git","ssh_url":"git@github.com:mazimkhan/greentea-client.git","clone_url":"https://github.com/mazimkhan/greentea-client.git","svn_url":"https://github.com/mazimkhan/greentea-client","homepage":null,"size":33,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"ARMmbed:master","ref":"master","sha":"81620d9be174dc7dde18c9ce7b5a99f069aaad09","user":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars.githubusercontent.com/u/8916057?v=3","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"repo":{"id":51553124,"name":"greentea-client","full_name":"ARMmbed/greentea-client","owner":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars.githubusercontent.com/u/8916057?v=3","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARMmbed/greentea-client","description":"DUT's (device under test) side of Greentea","fork":false,"url":"https://api.github.com/repos/ARMmbed/greentea-client","forks_url":"https://api.github.com/repos/ARMmbed/greentea-client/forks","keys_url":"https://api.github.com/repos/ARMmbed/greentea-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARMmbed/greentea-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARMmbed/greentea-client/teams","hooks_url":"https://api.github.com/repos/ARMmbed/greentea-client/hooks","issue_events_url":"https://api.github.com/repos/ARMmbed/greentea-client/issues/events{/number}","events_url":"https://api.github.com/repos/ARMmbed/greentea-client/events","assignees_url":"https://api.github.com/repos/ARMmbed/greentea-client/assignees{/user}","branches_url":"https://api.github.com/repos/ARMmbed/greentea-client/branches{/branch}","tags_url":"https://api.github.com/repos/ARMmbed/greentea-client/tags","blobs_url":"https://api.github.com/repos/ARMmbed/greentea-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARMmbed/greentea-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARMmbed/greentea-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARMmbed/greentea-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARMmbed/greentea-client/statuses/{sha}","languages_url":"https://api.github.com/repos/ARMmbed/greentea-client/languages","stargazers_url":"https://api.github.com/repos/ARMmbed/greentea-client/stargazers","contributors_url":"https://api.github.com/repos/ARMmbed/greentea-client/contributors","subscribers_url":"https://api.github.com/repos/ARMmbed/greentea-client/subscribers","subscription_url":"https://api.github.com/repos/ARMmbed/greentea-client/subscription","commits_url":"https://api.github.com/repos/ARMmbed/greentea-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARMmbed/greentea-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARMmbed/greentea-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARMmbed/greentea-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARMmbed/greentea-client/contents/{+path}","compare_url":"https://api.github.com/repos/ARMmbed/greentea-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARMmbed/greentea-client/merges","archive_url":"https://api.github.com/repos/ARMmbed/greentea-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARMmbed/greentea-client/downloads","issues_url":"https://api.github.com/repos/ARMmbed/greentea-client/issues{/number}","pulls_url":"https://api.github.com/repos/ARMmbed/greentea-client/pulls{/number}","milestones_url":"https://api.github.com/repos/ARMmbed/greentea-client/milestones{/number}","notifications_url":"https://api.github.com/repos/ARMmbed/greentea-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARMmbed/greentea-client/labels{/name}","releases_url":"https://api.github.com/repos/ARMmbed/greentea-client/releases{/id}","deployments_url":"https://api.github.com/repos/ARMmbed/greentea-client/deployments","created_at":"2016-02-11T22:51:31Z","updated_at":"2016-02-11T23:19:25Z","pushed_at":"2016-03-16T14:18:19Z","git_url":"git://github.com/ARMmbed/greentea-client.git","ssh_url":"git@github.com:ARMmbed/greentea-client.git","clone_url":"https://github.com/ARMmbed/greentea-client.git","svn_url":"https://github.com/ARMmbed/greentea-client","homepage":null,"size":37,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8"},"html":{"href":"https://github.com/ARMmbed/greentea-client/pull/8"},"issue":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/issues/8"},"comments":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/ARMmbed/greentea-client/statuses/cc20c7ae1f048b6a84c18590254105fba0702163"}}}}