{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/rosidl/pulls/comments/91103083","pull_request_review_id":11612872,"id":91103083,"diff_hunk":"@@ -139,4 +140,42 @@ void test_vector_fill(C * container, size_t size,\n   }\n }\n \n+/**\n+ * Helper function to generate a test pattern for string types.\n+ * Mininum and maximum values for the type and random numbers in the middle.\n+ * @param C Container (vector, array, etc) to be filled\n+ * @param size How many elements to fill in. Must size<=container_size\n+ * @param min Minimum value in the range to fill.\n+ * @param max Maximum value in the range to fill.\n+ * @param minlength Minimum length of the generated strings.\n+ * @param maxlength Maximum length of the generated strings.\n+ */\n+template<\n+  typename C,\n+  typename std::enable_if<\n+    std::is_same<typename C::value_type, typename std::string>::value\n+  >::type * = nullptr\n+>\n+void test_vector_fill(C * container, size_t size,\n+  int min, int max,\n+  int minlength, const int maxlength)\n+{\n+  std::default_random_engine rand_generator;\n+  std::uniform_int_distribution<int> randnum(min, max);\n+  std::uniform_int_distribution<int> randlen(minlength, maxlength);","path":"rosidl_generator_cpp/test/test_array_generator.hpp","position":67,"original_position":67,"commit_id":"aa60f685a0251718472891b032d3c7094e2b9949","original_commit_id":"aa60f685a0251718472891b032d3c7094e2b9949","user":{"login":"dirk-thomas","id":1335366,"avatar_url":"https://avatars.githubusercontent.com/u/1335366?v=3","gravatar_id":"","url":"https://api.github.com/users/dirk-thomas","html_url":"https://github.com/dirk-thomas","followers_url":"https://api.github.com/users/dirk-thomas/followers","following_url":"https://api.github.com/users/dirk-thomas/following{/other_user}","gists_url":"https://api.github.com/users/dirk-thomas/gists{/gist_id}","starred_url":"https://api.github.com/users/dirk-thomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirk-thomas/subscriptions","organizations_url":"https://api.github.com/users/dirk-thomas/orgs","repos_url":"https://api.github.com/users/dirk-thomas/repos","events_url":"https://api.github.com/users/dirk-thomas/events{/privacy}","received_events_url":"https://api.github.com/users/dirk-thomas/received_events","type":"User","site_admin":false},"body":"I would recommend not to use random numbers for any tests. The problem is that the test will be flaky of the result depends on the values. Instead use a \"known\" pattern, e.g. increment numbers, or ascii characters.","created_at":"2016-12-06T15:39:11Z","updated_at":"2016-12-06T15:39:11Z","html_url":"https://github.com/ros2/rosidl/pull/179#discussion_r91103083","pull_request_url":"https://api.github.com/repos/ros2/rosidl/pulls/179","_links":{"self":{"href":"https://api.github.com/repos/ros2/rosidl/pulls/comments/91103083"},"html":{"href":"https://github.com/ros2/rosidl/pull/179#discussion_r91103083"},"pull_request":{"href":"https://api.github.com/repos/ros2/rosidl/pulls/179"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/rosidl/pulls/179","id":96426493,"html_url":"https://github.com/ros2/rosidl/pull/179","diff_url":"https://github.com/ros2/rosidl/pull/179.diff","patch_url":"https://github.com/ros2/rosidl/pull/179.patch","issue_url":"https://api.github.com/repos/ros2/rosidl/issues/179","number":179,"state":"open","locked":false,"title":"String tests","user":{"login":"mikaelarguedas","id":6644208,"avatar_url":"https://avatars.githubusercontent.com/u/6644208?v=3","gravatar_id":"","url":"https://api.github.com/users/mikaelarguedas","html_url":"https://github.com/mikaelarguedas","followers_url":"https://api.github.com/users/mikaelarguedas/followers","following_url":"https://api.github.com/users/mikaelarguedas/following{/other_user}","gists_url":"https://api.github.com/users/mikaelarguedas/gists{/gist_id}","starred_url":"https://api.github.com/users/mikaelarguedas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikaelarguedas/subscriptions","organizations_url":"https://api.github.com/users/mikaelarguedas/orgs","repos_url":"https://api.github.com/users/mikaelarguedas/repos","events_url":"https://api.github.com/users/mikaelarguedas/events{/privacy}","received_events_url":"https://api.github.com/users/mikaelarguedas/received_events","type":"User","site_admin":false},"body":"This PR adds:\r\n * [rosidl_generator_py]\r\n   * length enforcement for bounded string in array in Python and the relevant unit tests\r\n * [rosidl_generator_cpp]\r\n   * a function to generate random string arrays/vector/boundedvector in c++\r\n   * msg files and tests for all String/StringArray types\r\n   * tests for PrimitivesStaticArrays that were not tested before\r\n   * a disabled test for testing bounded string assignment (we currently don't have any way to restrict std::string length)\r\n  * [rosidl_generator_c]\r\n    * a TODO to remind us to test bounded strings once length restriction is enforced","created_at":"2016-12-04T09:04:20Z","updated_at":"2016-12-06T15:39:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"469ae5e5232f229e6bf6d8ce73f807080360dad5","assignee":{"login":"mikaelarguedas","id":6644208,"avatar_url":"https://avatars.githubusercontent.com/u/6644208?v=3","gravatar_id":"","url":"https://api.github.com/users/mikaelarguedas","html_url":"https://github.com/mikaelarguedas","followers_url":"https://api.github.com/users/mikaelarguedas/followers","following_url":"https://api.github.com/users/mikaelarguedas/following{/other_user}","gists_url":"https://api.github.com/users/mikaelarguedas/gists{/gist_id}","starred_url":"https://api.github.com/users/mikaelarguedas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikaelarguedas/subscriptions","organizations_url":"https://api.github.com/users/mikaelarguedas/orgs","repos_url":"https://api.github.com/users/mikaelarguedas/repos","events_url":"https://api.github.com/users/mikaelarguedas/events{/privacy}","received_events_url":"https://api.github.com/users/mikaelarguedas/received_events","type":"User","site_admin":false},"assignees":[{"login":"mikaelarguedas","id":6644208,"avatar_url":"https://avatars.githubusercontent.com/u/6644208?v=3","gravatar_id":"","url":"https://api.github.com/users/mikaelarguedas","html_url":"https://github.com/mikaelarguedas","followers_url":"https://api.github.com/users/mikaelarguedas/followers","following_url":"https://api.github.com/users/mikaelarguedas/following{/other_user}","gists_url":"https://api.github.com/users/mikaelarguedas/gists{/gist_id}","starred_url":"https://api.github.com/users/mikaelarguedas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikaelarguedas/subscriptions","organizations_url":"https://api.github.com/users/mikaelarguedas/orgs","repos_url":"https://api.github.com/users/mikaelarguedas/repos","events_url":"https://api.github.com/users/mikaelarguedas/events{/privacy}","received_events_url":"https://api.github.com/users/mikaelarguedas/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ros2/rosidl/pulls/179/commits","review_comments_url":"https://api.github.com/repos/ros2/rosidl/pulls/179/comments","review_comment_url":"https://api.github.com/repos/ros2/rosidl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/rosidl/issues/179/comments","statuses_url":"https://api.github.com/repos/ros2/rosidl/statuses/aa60f685a0251718472891b032d3c7094e2b9949","head":{"label":"ros2:string_tests","ref":"string_tests","sha":"aa60f685a0251718472891b032d3c7094e2b9949","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":21748344,"name":"rosidl","full_name":"ros2/rosidl","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rosidl","description":"Packages which provide the ROS IDL (.msg) definition and code generation.","fork":false,"url":"https://api.github.com/repos/ros2/rosidl","forks_url":"https://api.github.com/repos/ros2/rosidl/forks","keys_url":"https://api.github.com/repos/ros2/rosidl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rosidl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rosidl/teams","hooks_url":"https://api.github.com/repos/ros2/rosidl/hooks","issue_events_url":"https://api.github.com/repos/ros2/rosidl/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rosidl/events","assignees_url":"https://api.github.com/repos/ros2/rosidl/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rosidl/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rosidl/tags","blobs_url":"https://api.github.com/repos/ros2/rosidl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rosidl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rosidl/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rosidl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rosidl/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rosidl/languages","stargazers_url":"https://api.github.com/repos/ros2/rosidl/stargazers","contributors_url":"https://api.github.com/repos/ros2/rosidl/contributors","subscribers_url":"https://api.github.com/repos/ros2/rosidl/subscribers","subscription_url":"https://api.github.com/repos/ros2/rosidl/subscription","commits_url":"https://api.github.com/repos/ros2/rosidl/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rosidl/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rosidl/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rosidl/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rosidl/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rosidl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rosidl/merges","archive_url":"https://api.github.com/repos/ros2/rosidl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rosidl/downloads","issues_url":"https://api.github.com/repos/ros2/rosidl/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rosidl/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rosidl/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rosidl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rosidl/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rosidl/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rosidl/deployments","created_at":"2014-07-11T19:19:18Z","updated_at":"2016-11-16T19:53:19Z","pushed_at":"2016-12-05T04:29:20Z","git_url":"git://github.com/ros2/rosidl.git","ssh_url":"git@github.com:ros2/rosidl.git","clone_url":"https://github.com/ros2/rosidl.git","svn_url":"https://github.com/ros2/rosidl","homepage":"","size":912,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":12,"forks":9,"open_issues":12,"watchers":3,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"c9545c9d3ea750e288fda40d9cb458e8798a6106","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":21748344,"name":"rosidl","full_name":"ros2/rosidl","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rosidl","description":"Packages which provide the ROS IDL (.msg) definition and code generation.","fork":false,"url":"https://api.github.com/repos/ros2/rosidl","forks_url":"https://api.github.com/repos/ros2/rosidl/forks","keys_url":"https://api.github.com/repos/ros2/rosidl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rosidl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rosidl/teams","hooks_url":"https://api.github.com/repos/ros2/rosidl/hooks","issue_events_url":"https://api.github.com/repos/ros2/rosidl/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rosidl/events","assignees_url":"https://api.github.com/repos/ros2/rosidl/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rosidl/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rosidl/tags","blobs_url":"https://api.github.com/repos/ros2/rosidl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rosidl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rosidl/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rosidl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rosidl/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rosidl/languages","stargazers_url":"https://api.github.com/repos/ros2/rosidl/stargazers","contributors_url":"https://api.github.com/repos/ros2/rosidl/contributors","subscribers_url":"https://api.github.com/repos/ros2/rosidl/subscribers","subscription_url":"https://api.github.com/repos/ros2/rosidl/subscription","commits_url":"https://api.github.com/repos/ros2/rosidl/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rosidl/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rosidl/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rosidl/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rosidl/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rosidl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rosidl/merges","archive_url":"https://api.github.com/repos/ros2/rosidl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rosidl/downloads","issues_url":"https://api.github.com/repos/ros2/rosidl/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rosidl/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rosidl/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rosidl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rosidl/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rosidl/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rosidl/deployments","created_at":"2014-07-11T19:19:18Z","updated_at":"2016-11-16T19:53:19Z","pushed_at":"2016-12-05T04:29:20Z","git_url":"git://github.com/ros2/rosidl.git","ssh_url":"git@github.com:ros2/rosidl.git","clone_url":"https://github.com/ros2/rosidl.git","svn_url":"https://github.com/ros2/rosidl","homepage":"","size":912,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":12,"forks":9,"open_issues":12,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/rosidl/pulls/179"},"html":{"href":"https://github.com/ros2/rosidl/pull/179"},"issue":{"href":"https://api.github.com/repos/ros2/rosidl/issues/179"},"comments":{"href":"https://api.github.com/repos/ros2/rosidl/issues/179/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/rosidl/pulls/179/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/rosidl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/rosidl/pulls/179/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/rosidl/statuses/aa60f685a0251718472891b032d3c7094e2b9949"}}}}
{"actor":{"display_login":"dirk-thomas"}}