{"action":"created","comment":{"url":"https://api.github.com/repos/arcosuc3m/grppi/pulls/comments/123874568","pull_request_review_id":46123324,"id":123874568,"diff_hunk":"@@ -0,0 +1,378 @@\n+/**\n+* @version\t\tGrPPI v0.2\n+* @copyright\t\tCopyright (C) 2017 Universidad Carlos III de Madrid. All rights reserved.\n+* @license\t\tGNU/GPL, see LICENSE.txt\n+* This program is free software: you can redistribute it and/or modify\n+* it under the terms of the GNU General Public License as published by\n+* the Free Software Foundation, either version 3 of the License, or\n+* (at your option) any later version.\n+*\n+* This program is distributed in the hope that it will be useful,\n+* but WITHOUT ANY WARRANTY; without even the implied warranty of\n+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+* GNU General Public License for more details.\n+*\n+* You have received a copy of the GNU General Public License in LICENSE.txt\n+* also available in <http://www.gnu.org/licenses/gpl.html>.\n+*\n+* See COPYRIGHT.txt for copyright notices and details.\n+*/\n+#include <atomic>\n+\n+#include <gtest/gtest.h>\n+\n+#include \"stream_reduce.h\"\n+#include \"common/polymorphic_execution.h\"\n+\n+#include \"supported_executions.h\"\n+\n+using namespace std;\n+using namespace grppi;\n+\n+template <typename T>\n+class stream_reduce_test : public ::testing::Test {\n+public:\n+  T execution_;\n+  polymorphic_execution poly_execution_ = \n+    make_polymorphic_execution<T>();\n+\n+  // Variables\n+  int out;\n+  int window;\n+  int offset;\n+\n+  // Vectors\n+  vector<int> v{};\n+  vector<int> v2{};\n+  vector<int> v3{};\n+  vector<int> w{};\n+  vector<int> expected{};\n+\n+  // Invocation counter\n+  std::atomic<int> invocations_gen{0};\n+  std::atomic<int> invocations_kernel{0};\n+  std::atomic<int> invocations_reduce{0};\n+\n+  void setup_empty() {\n+  }\n+\n+  void check_empty() {\n+    EXPECT_EQ(1, invocations_gen);\n+    EXPECT_EQ(0, invocations_kernel);\n+    EXPECT_EQ(0, invocations_reduce);\n+  }\n+\n+  void setup_single() {\n+    out = 0;\n+    v = vector<int>{1};\n+  }\n+\n+  void check_single() {\n+    EXPECT_EQ(2, invocations_gen);\n+    EXPECT_EQ(1, invocations_kernel);\n+    EXPECT_EQ(1, invocations_reduce);\n+\n+    EXPECT_EQ(2, this->out);\n+  }\n+\n+\n+  void setup_single_sink() {\n+    out = 0;\n+    v = vector<int>{1};\n+    window = 1;\n+    offset = 0;\n+  }\n+\n+  void check_single_sink() {\n+    EXPECT_EQ(2, invocations_gen);\n+    EXPECT_EQ(1, invocations_reduce);\n+\n+    EXPECT_EQ(1, this->out);\n+  }\n+\n+\n+  void setup_multiple() {\n+    out = 0;\n+    v = vector<int>{1,2,3,4,5};\n+  }\n+\n+  void check_multiple() {\n+    EXPECT_EQ(6, invocations_gen);\n+    EXPECT_EQ(5, invocations_kernel);\n+    EXPECT_EQ(5, invocations_reduce);\n+\n+    EXPECT_EQ(30, this->out);\n+  }\n+\n+\n+  void setup_multiple_sink() {\n+    out = 0;\n+    v = vector<int>{1,2,3,4,5};\n+    window = 1;\n+    offset = 1;\n+  }\n+\n+  void check_multiple_sink() {\n+    EXPECT_EQ(6, invocations_gen);\n+    EXPECT_EQ(5, invocations_reduce);\n+\n+    EXPECT_EQ(15, this->out);\n+  }\n+\n+  void setup_multiple_sink2() {\n+    out = 0;\n+    v = vector<int>{1,2,3,4,5,6};\n+    window = 2;\n+    offset = 1;\n+  }\n+\n+  void check_multiple_sink2() {\n+    EXPECT_EQ(7, invocations_gen);\n+    EXPECT_EQ(5, invocations_reduce);\n+\n+    EXPECT_EQ(35, this->out);\n+  }\n+\n+/*\n+  void setup_single_ary() {\n+    v = vector<int>{11};\n+    v2 = vector<int>{22};\n+    v3 = vector<int>{33};\n+    w = vector<int>{99};\n+  }\n+\n+  void check_single_ary() {\n+    EXPECT_EQ(1, this->invocations); // one invocation\n+    EXPECT_EQ(66, this->w[0]);\n+  }\n+\n+  void setup_multiple() {\n+    v = vector<int>{1,2,3,4,5};\n+    w = vector<int>(5);\n+    expected = vector<int>{2,4,6,8,10};\n+  }\n+\n+  void check_multiple() {\n+    EXPECT_EQ(5, this->invocations); // five invocations\n+    EXPECT_TRUE(equal(begin(this->expected), end(this->expected), begin(this->w)));\n+  }\n+\n+  void setup_multiple_ary() {\n+    v = vector<int>{1,2,3,4,5};\n+    v2 = vector<int>{2,4,6,8,10};\n+    v3 = vector<int>{10,10,10,10,10};\n+    w = vector<int>(5);\n+    expected = vector<int>{13,16,19,22,25};\n+  }\n+\n+  void check_multiple_ary() {\n+    EXPECT_EQ(5, this->invocations); // five invocations\n+    EXPECT_TRUE(equal(begin(this->expected), end(this->expected), begin(this->w)));\n+  }*/\n+\n+};\n+\n+// Test for execution policies defined in supported_executions.h\n+TYPED_TEST_CASE(stream_reduce_test, executions);\n+\n+TYPED_TEST(stream_reduce_test, static_empty)\n+{    \n+\n+  this->setup_empty();\n+  grppi::stream_reduce(this->execution_,\n+    [this]() { ","path":"unit_tests/stream_reduce.cpp","position":183,"original_position":183,"commit_id":"9c103d549bcb11ca159067bd03b1c8668efa64e5","original_commit_id":"9c103d549bcb11ca159067bd03b1c8668efa64e5","user":{"login":"jdgarciauc3m","id":6407837,"avatar_url":"https://avatars1.githubusercontent.com/u/6407837?v=3","gravatar_id":"","url":"https://api.github.com/users/jdgarciauc3m","html_url":"https://github.com/jdgarciauc3m","followers_url":"https://api.github.com/users/jdgarciauc3m/followers","following_url":"https://api.github.com/users/jdgarciauc3m/following{/other_user}","gists_url":"https://api.github.com/users/jdgarciauc3m/gists{/gist_id}","starred_url":"https://api.github.com/users/jdgarciauc3m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdgarciauc3m/subscriptions","organizations_url":"https://api.github.com/users/jdgarciauc3m/orgs","repos_url":"https://api.github.com/users/jdgarciauc3m/repos","events_url":"https://api.github.com/users/jdgarciauc3m/events{/privacy}","received_events_url":"https://api.github.com/users/jdgarciauc3m/received_events","type":"User","site_admin":false},"body":"[this]() -> optional<int> {\r\n  this->invocations++;\r\n  return {};\r\n}","created_at":"2017-06-24T09:53:41Z","updated_at":"2017-06-24T09:53:41Z","html_url":"https://github.com/arcosuc3m/grppi/pull/150#discussion_r123874568","pull_request_url":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150","_links":{"self":{"href":"https://api.github.com/repos/arcosuc3m/grppi/pulls/comments/123874568"},"html":{"href":"https://github.com/arcosuc3m/grppi/pull/150#discussion_r123874568"},"pull_request":{"href":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150"}}},"pull_request":{"url":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150","id":127235418,"html_url":"https://github.com/arcosuc3m/grppi/pull/150","diff_url":"https://github.com/arcosuc3m/grppi/pull/150.diff","patch_url":"https://github.com/arcosuc3m/grppi/pull/150.patch","issue_url":"https://api.github.com/repos/arcosuc3m/grppi/issues/150","number":150,"state":"open","locked":false,"title":"Add unit tests for stream_reduce() - issue 100","user":{"login":"AndresSanchezCuadrado","id":28568037,"avatar_url":"https://avatars0.githubusercontent.com/u/28568037?v=3","gravatar_id":"","url":"https://api.github.com/users/AndresSanchezCuadrado","html_url":"https://github.com/AndresSanchezCuadrado","followers_url":"https://api.github.com/users/AndresSanchezCuadrado/followers","following_url":"https://api.github.com/users/AndresSanchezCuadrado/following{/other_user}","gists_url":"https://api.github.com/users/AndresSanchezCuadrado/gists{/gist_id}","starred_url":"https://api.github.com/users/AndresSanchezCuadrado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndresSanchezCuadrado/subscriptions","organizations_url":"https://api.github.com/users/AndresSanchezCuadrado/orgs","repos_url":"https://api.github.com/users/AndresSanchezCuadrado/repos","events_url":"https://api.github.com/users/AndresSanchezCuadrado/events{/privacy}","received_events_url":"https://api.github.com/users/AndresSanchezCuadrado/received_events","type":"User","site_admin":false},"body":"unit test stream_reduce","created_at":"2017-06-23T15:44:59Z","updated_at":"2017-06-24T09:53:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"136f99384ba03d886fbe9b6a8cb9ea743fab3056","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150/commits","review_comments_url":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150/comments","review_comment_url":"https://api.github.com/repos/arcosuc3m/grppi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/arcosuc3m/grppi/issues/150/comments","statuses_url":"https://api.github.com/repos/arcosuc3m/grppi/statuses/9c103d549bcb11ca159067bd03b1c8668efa64e5","head":{"label":"arcosuc3m:issue-100","ref":"issue-100","sha":"9c103d549bcb11ca159067bd03b1c8668efa64e5","user":{"login":"arcosuc3m","id":19761216,"avatar_url":"https://avatars0.githubusercontent.com/u/19761216?v=3","gravatar_id":"","url":"https://api.github.com/users/arcosuc3m","html_url":"https://github.com/arcosuc3m","followers_url":"https://api.github.com/users/arcosuc3m/followers","following_url":"https://api.github.com/users/arcosuc3m/following{/other_user}","gists_url":"https://api.github.com/users/arcosuc3m/gists{/gist_id}","starred_url":"https://api.github.com/users/arcosuc3m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arcosuc3m/subscriptions","organizations_url":"https://api.github.com/users/arcosuc3m/orgs","repos_url":"https://api.github.com/users/arcosuc3m/repos","events_url":"https://api.github.com/users/arcosuc3m/events{/privacy}","received_events_url":"https://api.github.com/users/arcosuc3m/received_events","type":"Organization","site_admin":false},"repo":{"id":82172511,"name":"grppi","full_name":"arcosuc3m/grppi","owner":{"login":"arcosuc3m","id":19761216,"avatar_url":"https://avatars0.githubusercontent.com/u/19761216?v=3","gravatar_id":"","url":"https://api.github.com/users/arcosuc3m","html_url":"https://github.com/arcosuc3m","followers_url":"https://api.github.com/users/arcosuc3m/followers","following_url":"https://api.github.com/users/arcosuc3m/following{/other_user}","gists_url":"https://api.github.com/users/arcosuc3m/gists{/gist_id}","starred_url":"https://api.github.com/users/arcosuc3m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arcosuc3m/subscriptions","organizations_url":"https://api.github.com/users/arcosuc3m/orgs","repos_url":"https://api.github.com/users/arcosuc3m/repos","events_url":"https://api.github.com/users/arcosuc3m/events{/privacy}","received_events_url":"https://api.github.com/users/arcosuc3m/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/arcosuc3m/grppi","description":"Generic Reusable Parallel Patterns Interface","fork":false,"url":"https://api.github.com/repos/arcosuc3m/grppi","forks_url":"https://api.github.com/repos/arcosuc3m/grppi/forks","keys_url":"https://api.github.com/repos/arcosuc3m/grppi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arcosuc3m/grppi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arcosuc3m/grppi/teams","hooks_url":"https://api.github.com/repos/arcosuc3m/grppi/hooks","issue_events_url":"https://api.github.com/repos/arcosuc3m/grppi/issues/events{/number}","events_url":"https://api.github.com/repos/arcosuc3m/grppi/events","assignees_url":"https://api.github.com/repos/arcosuc3m/grppi/assignees{/user}","branches_url":"https://api.github.com/repos/arcosuc3m/grppi/branches{/branch}","tags_url":"https://api.github.com/repos/arcosuc3m/grppi/tags","blobs_url":"https://api.github.com/repos/arcosuc3m/grppi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arcosuc3m/grppi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arcosuc3m/grppi/git/refs{/sha}","trees_url":"https://api.github.com/repos/arcosuc3m/grppi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arcosuc3m/grppi/statuses/{sha}","languages_url":"https://api.github.com/repos/arcosuc3m/grppi/languages","stargazers_url":"https://api.github.com/repos/arcosuc3m/grppi/stargazers","contributors_url":"https://api.github.com/repos/arcosuc3m/grppi/contributors","subscribers_url":"https://api.github.com/repos/arcosuc3m/grppi/subscribers","subscription_url":"https://api.github.com/repos/arcosuc3m/grppi/subscription","commits_url":"https://api.github.com/repos/arcosuc3m/grppi/commits{/sha}","git_commits_url":"https://api.github.com/repos/arcosuc3m/grppi/git/commits{/sha}","comments_url":"https://api.github.com/repos/arcosuc3m/grppi/comments{/number}","issue_comment_url":"https://api.github.com/repos/arcosuc3m/grppi/issues/comments{/number}","contents_url":"https://api.github.com/repos/arcosuc3m/grppi/contents/{+path}","compare_url":"https://api.github.com/repos/arcosuc3m/grppi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arcosuc3m/grppi/merges","archive_url":"https://api.github.com/repos/arcosuc3m/grppi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arcosuc3m/grppi/downloads","issues_url":"https://api.github.com/repos/arcosuc3m/grppi/issues{/number}","pulls_url":"https://api.github.com/repos/arcosuc3m/grppi/pulls{/number}","milestones_url":"https://api.github.com/repos/arcosuc3m/grppi/milestones{/number}","notifications_url":"https://api.github.com/repos/arcosuc3m/grppi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arcosuc3m/grppi/labels{/name}","releases_url":"https://api.github.com/repos/arcosuc3m/grppi/releases{/id}","deployments_url":"https://api.github.com/repos/arcosuc3m/grppi/deployments","created_at":"2017-02-16T11:13:19Z","updated_at":"2017-05-05T08:22:47Z","pushed_at":"2017-06-23T15:44:59Z","git_url":"git://github.com/arcosuc3m/grppi.git","ssh_url":"git@github.com:arcosuc3m/grppi.git","clone_url":"https://github.com/arcosuc3m/grppi.git","svn_url":"https://github.com/arcosuc3m/grppi","homepage":null,"size":621,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":37,"forks":0,"open_issues":37,"watchers":1,"default_branch":"master"}},"base":{"label":"arcosuc3m:latest","ref":"latest","sha":"30000349be6d3025339c1682dda01671abee2353","user":{"login":"arcosuc3m","id":19761216,"avatar_url":"https://avatars0.githubusercontent.com/u/19761216?v=3","gravatar_id":"","url":"https://api.github.com/users/arcosuc3m","html_url":"https://github.com/arcosuc3m","followers_url":"https://api.github.com/users/arcosuc3m/followers","following_url":"https://api.github.com/users/arcosuc3m/following{/other_user}","gists_url":"https://api.github.com/users/arcosuc3m/gists{/gist_id}","starred_url":"https://api.github.com/users/arcosuc3m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arcosuc3m/subscriptions","organizations_url":"https://api.github.com/users/arcosuc3m/orgs","repos_url":"https://api.github.com/users/arcosuc3m/repos","events_url":"https://api.github.com/users/arcosuc3m/events{/privacy}","received_events_url":"https://api.github.com/users/arcosuc3m/received_events","type":"Organization","site_admin":false},"repo":{"id":82172511,"name":"grppi","full_name":"arcosuc3m/grppi","owner":{"login":"arcosuc3m","id":19761216,"avatar_url":"https://avatars0.githubusercontent.com/u/19761216?v=3","gravatar_id":"","url":"https://api.github.com/users/arcosuc3m","html_url":"https://github.com/arcosuc3m","followers_url":"https://api.github.com/users/arcosuc3m/followers","following_url":"https://api.github.com/users/arcosuc3m/following{/other_user}","gists_url":"https://api.github.com/users/arcosuc3m/gists{/gist_id}","starred_url":"https://api.github.com/users/arcosuc3m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arcosuc3m/subscriptions","organizations_url":"https://api.github.com/users/arcosuc3m/orgs","repos_url":"https://api.github.com/users/arcosuc3m/repos","events_url":"https://api.github.com/users/arcosuc3m/events{/privacy}","received_events_url":"https://api.github.com/users/arcosuc3m/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/arcosuc3m/grppi","description":"Generic Reusable Parallel Patterns Interface","fork":false,"url":"https://api.github.com/repos/arcosuc3m/grppi","forks_url":"https://api.github.com/repos/arcosuc3m/grppi/forks","keys_url":"https://api.github.com/repos/arcosuc3m/grppi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arcosuc3m/grppi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arcosuc3m/grppi/teams","hooks_url":"https://api.github.com/repos/arcosuc3m/grppi/hooks","issue_events_url":"https://api.github.com/repos/arcosuc3m/grppi/issues/events{/number}","events_url":"https://api.github.com/repos/arcosuc3m/grppi/events","assignees_url":"https://api.github.com/repos/arcosuc3m/grppi/assignees{/user}","branches_url":"https://api.github.com/repos/arcosuc3m/grppi/branches{/branch}","tags_url":"https://api.github.com/repos/arcosuc3m/grppi/tags","blobs_url":"https://api.github.com/repos/arcosuc3m/grppi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arcosuc3m/grppi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arcosuc3m/grppi/git/refs{/sha}","trees_url":"https://api.github.com/repos/arcosuc3m/grppi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arcosuc3m/grppi/statuses/{sha}","languages_url":"https://api.github.com/repos/arcosuc3m/grppi/languages","stargazers_url":"https://api.github.com/repos/arcosuc3m/grppi/stargazers","contributors_url":"https://api.github.com/repos/arcosuc3m/grppi/contributors","subscribers_url":"https://api.github.com/repos/arcosuc3m/grppi/subscribers","subscription_url":"https://api.github.com/repos/arcosuc3m/grppi/subscription","commits_url":"https://api.github.com/repos/arcosuc3m/grppi/commits{/sha}","git_commits_url":"https://api.github.com/repos/arcosuc3m/grppi/git/commits{/sha}","comments_url":"https://api.github.com/repos/arcosuc3m/grppi/comments{/number}","issue_comment_url":"https://api.github.com/repos/arcosuc3m/grppi/issues/comments{/number}","contents_url":"https://api.github.com/repos/arcosuc3m/grppi/contents/{+path}","compare_url":"https://api.github.com/repos/arcosuc3m/grppi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arcosuc3m/grppi/merges","archive_url":"https://api.github.com/repos/arcosuc3m/grppi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arcosuc3m/grppi/downloads","issues_url":"https://api.github.com/repos/arcosuc3m/grppi/issues{/number}","pulls_url":"https://api.github.com/repos/arcosuc3m/grppi/pulls{/number}","milestones_url":"https://api.github.com/repos/arcosuc3m/grppi/milestones{/number}","notifications_url":"https://api.github.com/repos/arcosuc3m/grppi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arcosuc3m/grppi/labels{/name}","releases_url":"https://api.github.com/repos/arcosuc3m/grppi/releases{/id}","deployments_url":"https://api.github.com/repos/arcosuc3m/grppi/deployments","created_at":"2017-02-16T11:13:19Z","updated_at":"2017-05-05T08:22:47Z","pushed_at":"2017-06-23T15:44:59Z","git_url":"git://github.com/arcosuc3m/grppi.git","ssh_url":"git@github.com:arcosuc3m/grppi.git","clone_url":"https://github.com/arcosuc3m/grppi.git","svn_url":"https://github.com/arcosuc3m/grppi","homepage":null,"size":621,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":37,"forks":0,"open_issues":37,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150"},"html":{"href":"https://github.com/arcosuc3m/grppi/pull/150"},"issue":{"href":"https://api.github.com/repos/arcosuc3m/grppi/issues/150"},"comments":{"href":"https://api.github.com/repos/arcosuc3m/grppi/issues/150/comments"},"review_comments":{"href":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150/comments"},"review_comment":{"href":"https://api.github.com/repos/arcosuc3m/grppi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/arcosuc3m/grppi/pulls/150/commits"},"statuses":{"href":"https://api.github.com/repos/arcosuc3m/grppi/statuses/9c103d549bcb11ca159067bd03b1c8668efa64e5"}}}}
{"actor":{"display_login":"jdgarciauc3m"}}