{"action":"created","comment":{"url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/comments/54336869","id":54336869,"diff_hunk":"@@ -0,0 +1,145 @@\n+#include <check.h>\n+#include \"serveur.h\"\n+#include \"test_dummies.h\"\n+\n+START_TEST(commands_find_command_unrecognised_command)\n+{\n+\tt_zappy\t\tvar;\n+\tt_player\t*p = &var.players[5];\n+\tchar\t\tstr[10] = \"caca\\n\";\n+\n+\tdummy_t_zappy_without_board(&var);\n+\tdummy_t_player(&var, p);\n+\tfind_command(&var, p, str, 4);\n+\tck_assert_str_eq(p->snd.buf[p->snd.read], \"Unrecognised command\\n\");\n+\tclean_msg_queue(p);\n+\trm_teams(&var.teams, &var.nb_team);\n+}\n+END_TEST\n+\n+START_TEST(commands_find_command_unrecognised_command_gfx)\n+{\n+\tt_zappy\t\tvar;\n+\tt_player\t*p = &var.players[5];\n+\tchar\t\tstr[10] = \"caca\\n\";\n+\n+\tdummy_t_zappy_without_board(&var);\n+\tdummy_t_player(&var, p);\n+\tp->status = FD_GFX;\n+\tfind_command(&var, p, str, 4);\n+\tck_assert_str_eq(p->snd.buf[p->snd.read], \"suc\\n\");\n+\tclean_msg_queue(p);\n+\trm_teams(&var.teams, &var.nb_team);\n+}\n+END_TEST\n+\n+START_TEST(commands_find_command_command_format_error)\n+{\n+\tt_zappy\t\tvar;\n+\tt_player\t*p = &var.players[5];\n+\tchar\t\tstr[10] = \"prend\\n\";\n+\n+\tdummy_t_zappy_without_board(&var);\n+\tdummy_t_player(&var, p);\n+\tfind_command(&var, p, str, 5);\n+\tck_assert_str_eq(p->snd.buf[p->snd.read], \"Command format error\\n\");\n+\tclean_msg_queue(p);\n+\trm_teams(&var.teams, &var.nb_team);\n+}\n+END_TEST\n+\n+START_TEST(commands_find_command_command_format_error_gfx)\n+{\n+\tt_zappy\t\tvar;\n+\tt_player\t*p = &var.players[5];\n+\tchar\t\tstr[10] = \"sst\\n\";\n+\n+\tdummy_t_zappy_without_board(&var);\n+\tdummy_t_player(&var, p);\n+\tp->status = FD_GFX;\n+\tfind_command(&var, p, str, 3);\n+\tck_assert_str_eq(p->snd.buf[p->snd.read], \"sbp\\n\");\n+\tclean_msg_queue(p);\n+\trm_teams(&var.teams, &var.nb_team);\n+}\n+END_TEST\n+\n+START_TEST(commands_find_command_unsupported_command)\n+{\n+\tt_zappy\t\tvar;\n+\tt_player\t*p = &var.players[5];\n+\tchar\t\tstr[10] = \"avance\\n\";\n+\n+\tdummy_t_zappy_without_board(&var);\n+\tdummy_t_player(&var, p);\n+\tfind_command(&var, p, str, 6);\n+\tck_assert_str_eq(p->snd.buf[p->snd.read], \"Unsupported command\\n\");\n+\tclean_msg_queue(p);\n+\trm_teams(&var.teams, &var.nb_team);\n+}\n+END_TEST\n+\n+START_TEST(commands_find_command_unsupported_command_gfx)\n+{\n+\tt_zappy\t\tvar;\n+\tt_player\t*p = &var.players[5];\n+\tchar\t\tstr[10] = \"sgt\\n\";\n+\n+\tdummy_t_zappy_without_board(&var);\n+\tdummy_t_player(&var, p);\n+\tp->status = FD_GFX;\n+\tfind_command(&var, p, str, 3);\n+\tck_assert_str_eq(p->snd.buf[p->snd.read], \"suc\\n\");\n+\tclean_msg_queue(p);\n+\trm_teams(&var.teams, &var.nb_team);\n+}\n+END_TEST\n+\n+//START_TEST(commands_find_command_unauthorised_command)\n+//{\n+//\tt_zappy\t\tvar;\n+//\tt_player\t*p = &var.players[5];\n+//\tchar\t\tstr[10] = \"msz\\n\";\n+//\n+//\tdummy_t_zappy_without_board(&var);\n+//\tdummy_t_player(&var, p);\n+//\tfind_command(&var, p, str, 3);\n+//\tck_assert_str_eq(p->snd.buf[p->snd.read], \"Unauthorised command\\n\");\n+//\tclean_msg_queue(p);\n+//\trm_teams(&var.teams, &var.nb_team);\n+//}\n+//END_TEST\n+\n+//START_TEST(commands_find_command_unauthorised_command_gfx)\n+//{\n+//\tt_zappy\t\tvar;\n+//\tt_player\t*p = &var.players[5];\n+//\tchar\t\tstr[10] = \"prend\\n\";\n+//\n+//\tdummy_t_zappy_without_board(&var);\n+//\tdummy_t_player(&var, p);\n+//\tfind_command(&var, p, str, 5);\n+//\tp->status = FD_GFX;\n+//\tck_assert_str_eq(p->snd.buf[p->snd.read], \"suc\\n\");\n+//\tclean_msg_queue(p);\n+//\trm_teams(&var.teams, &var.nb_team);\n+//}\n+//END_TEST","path":"test/src/commands/find_command.c","position":127,"original_position":127,"commit_id":"4f1f3c76cd48ae36888db201db6b81710c909d17","original_commit_id":"4f1f3c76cd48ae36888db201db6b81710c909d17","user":{"login":"jability","id":1519461,"avatar_url":"https://avatars.githubusercontent.com/u/1519461?v=3","gravatar_id":"","url":"https://api.github.com/users/jability","html_url":"https://github.com/jability","followers_url":"https://api.github.com/users/jability/followers","following_url":"https://api.github.com/users/jability/following{/other_user}","gists_url":"https://api.github.com/users/jability/gists{/gist_id}","starred_url":"https://api.github.com/users/jability/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jability/subscriptions","organizations_url":"https://api.github.com/users/jability/orgs","repos_url":"https://api.github.com/users/jability/repos","events_url":"https://api.github.com/users/jability/events{/privacy}","received_events_url":"https://api.github.com/users/jability/received_events","type":"User","site_admin":false},"body":"What about these tests ?","created_at":"2016-02-27T18:14:20Z","updated_at":"2016-02-27T18:14:20Z","html_url":"https://github.com/DwarfOfTheRap/zappy_server/pull/6#discussion_r54336869","pull_request_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/comments/54336869"},"html":{"href":"https://github.com/DwarfOfTheRap/zappy_server/pull/6#discussion_r54336869"},"pull_request":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6","id":60209806,"html_url":"https://github.com/DwarfOfTheRap/zappy_server/pull/6","diff_url":"https://github.com/DwarfOfTheRap/zappy_server/pull/6.diff","patch_url":"https://github.com/DwarfOfTheRap/zappy_server/pull/6.patch","issue_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/6","number":6,"state":"open","locked":false,"title":"Feature/communication","user":{"login":"Geam","id":5331937,"avatar_url":"https://avatars.githubusercontent.com/u/5331937?v=3","gravatar_id":"","url":"https://api.github.com/users/Geam","html_url":"https://github.com/Geam","followers_url":"https://api.github.com/users/Geam/followers","following_url":"https://api.github.com/users/Geam/following{/other_user}","gists_url":"https://api.github.com/users/Geam/gists{/gist_id}","starred_url":"https://api.github.com/users/Geam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Geam/subscriptions","organizations_url":"https://api.github.com/users/Geam/orgs","repos_url":"https://api.github.com/users/Geam/repos","events_url":"https://api.github.com/users/Geam/events{/privacy}","received_events_url":"https://api.github.com/users/Geam/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-22T17:31:18Z","updated_at":"2016-02-27T18:14:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"395d9099511a392f2ea2428de7e08ac111abdf83","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6/commits","review_comments_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6/comments","review_comment_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/6/comments","statuses_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/statuses/4f1f3c76cd48ae36888db201db6b81710c909d17","head":{"label":"DwarfOfTheRap:feature/communication","ref":"feature/communication","sha":"4f1f3c76cd48ae36888db201db6b81710c909d17","user":{"login":"DwarfOfTheRap","id":16255038,"avatar_url":"https://avatars.githubusercontent.com/u/16255038?v=3","gravatar_id":"","url":"https://api.github.com/users/DwarfOfTheRap","html_url":"https://github.com/DwarfOfTheRap","followers_url":"https://api.github.com/users/DwarfOfTheRap/followers","following_url":"https://api.github.com/users/DwarfOfTheRap/following{/other_user}","gists_url":"https://api.github.com/users/DwarfOfTheRap/gists{/gist_id}","starred_url":"https://api.github.com/users/DwarfOfTheRap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DwarfOfTheRap/subscriptions","organizations_url":"https://api.github.com/users/DwarfOfTheRap/orgs","repos_url":"https://api.github.com/users/DwarfOfTheRap/repos","events_url":"https://api.github.com/users/DwarfOfTheRap/events{/privacy}","received_events_url":"https://api.github.com/users/DwarfOfTheRap/received_events","type":"Organization","site_admin":false},"repo":{"id":47882245,"name":"zappy_server","full_name":"DwarfOfTheRap/zappy_server","owner":{"login":"DwarfOfTheRap","id":16255038,"avatar_url":"https://avatars.githubusercontent.com/u/16255038?v=3","gravatar_id":"","url":"https://api.github.com/users/DwarfOfTheRap","html_url":"https://github.com/DwarfOfTheRap","followers_url":"https://api.github.com/users/DwarfOfTheRap/followers","following_url":"https://api.github.com/users/DwarfOfTheRap/following{/other_user}","gists_url":"https://api.github.com/users/DwarfOfTheRap/gists{/gist_id}","starred_url":"https://api.github.com/users/DwarfOfTheRap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DwarfOfTheRap/subscriptions","organizations_url":"https://api.github.com/users/DwarfOfTheRap/orgs","repos_url":"https://api.github.com/users/DwarfOfTheRap/repos","events_url":"https://api.github.com/users/DwarfOfTheRap/events{/privacy}","received_events_url":"https://api.github.com/users/DwarfOfTheRap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DwarfOfTheRap/zappy_server","description":"42 school project zappy - server","fork":false,"url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server","forks_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/forks","keys_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/teams","hooks_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/hooks","issue_events_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/events{/number}","events_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/events","assignees_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/assignees{/user}","branches_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/branches{/branch}","tags_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/tags","blobs_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/refs{/sha}","trees_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/statuses/{sha}","languages_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/languages","stargazers_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/stargazers","contributors_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/contributors","subscribers_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/subscribers","subscription_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/subscription","commits_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/commits{/sha}","git_commits_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/commits{/sha}","comments_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/comments{/number}","issue_comment_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/comments{/number}","contents_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/contents/{+path}","compare_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/merges","archive_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/downloads","issues_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues{/number}","pulls_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls{/number}","milestones_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/milestones{/number}","notifications_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/labels{/name}","releases_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/releases{/id}","deployments_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/deployments","created_at":"2015-12-12T14:57:54Z","updated_at":"2015-12-12T14:57:54Z","pushed_at":"2016-02-27T17:30:39Z","git_url":"git://github.com/DwarfOfTheRap/zappy_server.git","ssh_url":"git@github.com:DwarfOfTheRap/zappy_server.git","clone_url":"https://github.com/DwarfOfTheRap/zappy_server.git","svn_url":"https://github.com/DwarfOfTheRap/zappy_server","homepage":null,"size":178,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"DwarfOfTheRap:develop","ref":"develop","sha":"1881d7d29f0bc64043b0735f5a04559232309905","user":{"login":"DwarfOfTheRap","id":16255038,"avatar_url":"https://avatars.githubusercontent.com/u/16255038?v=3","gravatar_id":"","url":"https://api.github.com/users/DwarfOfTheRap","html_url":"https://github.com/DwarfOfTheRap","followers_url":"https://api.github.com/users/DwarfOfTheRap/followers","following_url":"https://api.github.com/users/DwarfOfTheRap/following{/other_user}","gists_url":"https://api.github.com/users/DwarfOfTheRap/gists{/gist_id}","starred_url":"https://api.github.com/users/DwarfOfTheRap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DwarfOfTheRap/subscriptions","organizations_url":"https://api.github.com/users/DwarfOfTheRap/orgs","repos_url":"https://api.github.com/users/DwarfOfTheRap/repos","events_url":"https://api.github.com/users/DwarfOfTheRap/events{/privacy}","received_events_url":"https://api.github.com/users/DwarfOfTheRap/received_events","type":"Organization","site_admin":false},"repo":{"id":47882245,"name":"zappy_server","full_name":"DwarfOfTheRap/zappy_server","owner":{"login":"DwarfOfTheRap","id":16255038,"avatar_url":"https://avatars.githubusercontent.com/u/16255038?v=3","gravatar_id":"","url":"https://api.github.com/users/DwarfOfTheRap","html_url":"https://github.com/DwarfOfTheRap","followers_url":"https://api.github.com/users/DwarfOfTheRap/followers","following_url":"https://api.github.com/users/DwarfOfTheRap/following{/other_user}","gists_url":"https://api.github.com/users/DwarfOfTheRap/gists{/gist_id}","starred_url":"https://api.github.com/users/DwarfOfTheRap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DwarfOfTheRap/subscriptions","organizations_url":"https://api.github.com/users/DwarfOfTheRap/orgs","repos_url":"https://api.github.com/users/DwarfOfTheRap/repos","events_url":"https://api.github.com/users/DwarfOfTheRap/events{/privacy}","received_events_url":"https://api.github.com/users/DwarfOfTheRap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DwarfOfTheRap/zappy_server","description":"42 school project zappy - server","fork":false,"url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server","forks_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/forks","keys_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/teams","hooks_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/hooks","issue_events_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/events{/number}","events_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/events","assignees_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/assignees{/user}","branches_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/branches{/branch}","tags_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/tags","blobs_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/refs{/sha}","trees_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/statuses/{sha}","languages_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/languages","stargazers_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/stargazers","contributors_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/contributors","subscribers_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/subscribers","subscription_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/subscription","commits_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/commits{/sha}","git_commits_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/git/commits{/sha}","comments_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/comments{/number}","issue_comment_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/comments{/number}","contents_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/contents/{+path}","compare_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/merges","archive_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/downloads","issues_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues{/number}","pulls_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls{/number}","milestones_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/milestones{/number}","notifications_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/labels{/name}","releases_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/releases{/id}","deployments_url":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/deployments","created_at":"2015-12-12T14:57:54Z","updated_at":"2015-12-12T14:57:54Z","pushed_at":"2016-02-27T17:30:39Z","git_url":"git://github.com/DwarfOfTheRap/zappy_server.git","ssh_url":"git@github.com:DwarfOfTheRap/zappy_server.git","clone_url":"https://github.com/DwarfOfTheRap/zappy_server.git","svn_url":"https://github.com/DwarfOfTheRap/zappy_server","homepage":null,"size":178,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6"},"html":{"href":"https://github.com/DwarfOfTheRap/zappy_server/pull/6"},"issue":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/6"},"comments":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/DwarfOfTheRap/zappy_server/statuses/4f1f3c76cd48ae36888db201db6b81710c909d17"}}}}