{"action":"created","comment":{"url":"https://api.github.com/repos/WebAssembly/spec/pulls/comments/38813035","id":38813035,"diff_hunk":"@@ -71,6 +75,42 @@ let run_command cmd =\n       Error.error cmd.at \"assertion failed\"\n     end\n \n+  | AssertHeapEq (offset, expected) ->\n+    let m = match !current_module with\n+      | Some m -> m\n+      | None -> Error.error cmd.at \"no module defined to examine heap\"\n+    in\n+    let mem = Eval.get_module_memory m in\n+    let count = String.length expected in\n+\n+    for i=0 to (count-1) do\n+      let expected_ch = Char.code expected.[i] in\n+      let actual_ch = match Memory.load mem i UInt8Mem Int32Type with\n+        | Int32 i -> Int32.to_int i\n+        | _ -> Error.error cmd.at \"memory load returned wrong type\"\n+      in\n+\n+      if expected_ch <> actual_ch then begin\n+        print_string \"Result: \\\"\";\n+        \n+        for j=0 to (count-1) do\n+          let ch = match Memory.load mem j UInt8Mem Int32Type with\n+            | Int32 i -> Char.chr (Int32.to_int i)\n+            | _ -> Error.error cmd.at \"memory load returned wrong type\"","path":"ml-proto/src/script.ml","position":43,"original_position":43,"commit_id":"458aab99d97cb0e93a91fa623fd200b0c0623903","original_commit_id":"458aab99d97cb0e93a91fa623fd200b0c0623903","user":{"login":"rossberg-chromium","id":4247099,"avatar_url":"https://avatars.githubusercontent.com/u/4247099?v=3","gravatar_id":"","url":"https://api.github.com/users/rossberg-chromium","html_url":"https://github.com/rossberg-chromium","followers_url":"https://api.github.com/users/rossberg-chromium/followers","following_url":"https://api.github.com/users/rossberg-chromium/following{/other_user}","gists_url":"https://api.github.com/users/rossberg-chromium/gists{/gist_id}","starred_url":"https://api.github.com/users/rossberg-chromium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rossberg-chromium/subscriptions","organizations_url":"https://api.github.com/users/rossberg-chromium/orgs","repos_url":"https://api.github.com/users/rossberg-chromium/repos","events_url":"https://api.github.com/users/rossberg-chromium/events{/privacy}","received_events_url":"https://api.github.com/users/rossberg-chromium/received_events","type":"User","site_admin":false},"body":"Same here.","created_at":"2015-09-05T17:42:14Z","updated_at":"2015-09-05T17:42:14Z","html_url":"https://github.com/WebAssembly/spec/pull/49#discussion_r38813035","pull_request_url":"https://api.github.com/repos/WebAssembly/spec/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/WebAssembly/spec/pulls/comments/38813035"},"html":{"href":"https://github.com/WebAssembly/spec/pull/49#discussion_r38813035"},"pull_request":{"href":"https://api.github.com/repos/WebAssembly/spec/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/WebAssembly/spec/pulls/49","id":44271121,"html_url":"https://github.com/WebAssembly/spec/pull/49","diff_url":"https://github.com/WebAssembly/spec/pull/49.diff","patch_url":"https://github.com/WebAssembly/spec/pull/49.patch","issue_url":"https://api.github.com/repos/WebAssembly/spec/issues/49","number":49,"state":"open","locked":false,"title":"Add assert_heap_eq script command to check contents of a heap region","user":{"login":"kg","id":198130,"avatar_url":"https://avatars.githubusercontent.com/u/198130?v=3","gravatar_id":"","url":"https://api.github.com/users/kg","html_url":"https://github.com/kg","followers_url":"https://api.github.com/users/kg/followers","following_url":"https://api.github.com/users/kg/following{/other_user}","gists_url":"https://api.github.com/users/kg/gists{/gist_id}","starred_url":"https://api.github.com/users/kg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kg/subscriptions","organizations_url":"https://api.github.com/users/kg/orgs","repos_url":"https://api.github.com/users/kg/repos","events_url":"https://api.github.com/users/kg/events{/privacy}","received_events_url":"https://api.github.com/users/kg/received_events","type":"User","site_admin":false},"body":"Added an ```assert_heap_eq``` script command alongside ```assert_eq```. You specify a base offset into the module heap along with an expected series of bytes (as a string with escapes, like memory segments).\r\n\r\nThis allows straightforward tests for algorithms that don't merely produce a few bytes ([this test](https://github.com/WebAssembly/ilwasm/blob/master/third_party/tests/Strcat.cs), for example.)","created_at":"2015-09-04T23:45:09Z","updated_at":"2015-09-05T17:42:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68c01f142787f8c427d906e9ef04314e5307bd74","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/WebAssembly/spec/pulls/49/commits","review_comments_url":"https://api.github.com/repos/WebAssembly/spec/pulls/49/comments","review_comment_url":"https://api.github.com/repos/WebAssembly/spec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WebAssembly/spec/issues/49/comments","statuses_url":"https://api.github.com/repos/WebAssembly/spec/statuses/458aab99d97cb0e93a91fa623fd200b0c0623903","head":{"label":"kg:assert_heap_eq","ref":"assert_heap_eq","sha":"458aab99d97cb0e93a91fa623fd200b0c0623903","user":{"login":"kg","id":198130,"avatar_url":"https://avatars.githubusercontent.com/u/198130?v=3","gravatar_id":"","url":"https://api.github.com/users/kg","html_url":"https://github.com/kg","followers_url":"https://api.github.com/users/kg/followers","following_url":"https://api.github.com/users/kg/following{/other_user}","gists_url":"https://api.github.com/users/kg/gists{/gist_id}","starred_url":"https://api.github.com/users/kg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kg/subscriptions","organizations_url":"https://api.github.com/users/kg/orgs","repos_url":"https://api.github.com/users/kg/repos","events_url":"https://api.github.com/users/kg/events{/privacy}","received_events_url":"https://api.github.com/users/kg/received_events","type":"User","site_admin":false},"repo":{"id":40661658,"name":"spec","full_name":"kg/spec","owner":{"login":"kg","id":198130,"avatar_url":"https://avatars.githubusercontent.com/u/198130?v=3","gravatar_id":"","url":"https://api.github.com/users/kg","html_url":"https://github.com/kg","followers_url":"https://api.github.com/users/kg/followers","following_url":"https://api.github.com/users/kg/following{/other_user}","gists_url":"https://api.github.com/users/kg/gists{/gist_id}","starred_url":"https://api.github.com/users/kg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kg/subscriptions","organizations_url":"https://api.github.com/users/kg/orgs","repos_url":"https://api.github.com/users/kg/repos","events_url":"https://api.github.com/users/kg/events{/privacy}","received_events_url":"https://api.github.com/users/kg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kg/spec","description":"Staging ground for artifacts related to an MVP spec","fork":true,"url":"https://api.github.com/repos/kg/spec","forks_url":"https://api.github.com/repos/kg/spec/forks","keys_url":"https://api.github.com/repos/kg/spec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kg/spec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kg/spec/teams","hooks_url":"https://api.github.com/repos/kg/spec/hooks","issue_events_url":"https://api.github.com/repos/kg/spec/issues/events{/number}","events_url":"https://api.github.com/repos/kg/spec/events","assignees_url":"https://api.github.com/repos/kg/spec/assignees{/user}","branches_url":"https://api.github.com/repos/kg/spec/branches{/branch}","tags_url":"https://api.github.com/repos/kg/spec/tags","blobs_url":"https://api.github.com/repos/kg/spec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kg/spec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kg/spec/git/refs{/sha}","trees_url":"https://api.github.com/repos/kg/spec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kg/spec/statuses/{sha}","languages_url":"https://api.github.com/repos/kg/spec/languages","stargazers_url":"https://api.github.com/repos/kg/spec/stargazers","contributors_url":"https://api.github.com/repos/kg/spec/contributors","subscribers_url":"https://api.github.com/repos/kg/spec/subscribers","subscription_url":"https://api.github.com/repos/kg/spec/subscription","commits_url":"https://api.github.com/repos/kg/spec/commits{/sha}","git_commits_url":"https://api.github.com/repos/kg/spec/git/commits{/sha}","comments_url":"https://api.github.com/repos/kg/spec/comments{/number}","issue_comment_url":"https://api.github.com/repos/kg/spec/issues/comments{/number}","contents_url":"https://api.github.com/repos/kg/spec/contents/{+path}","compare_url":"https://api.github.com/repos/kg/spec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kg/spec/merges","archive_url":"https://api.github.com/repos/kg/spec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kg/spec/downloads","issues_url":"https://api.github.com/repos/kg/spec/issues{/number}","pulls_url":"https://api.github.com/repos/kg/spec/pulls{/number}","milestones_url":"https://api.github.com/repos/kg/spec/milestones{/number}","notifications_url":"https://api.github.com/repos/kg/spec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kg/spec/labels{/name}","releases_url":"https://api.github.com/repos/kg/spec/releases{/id}","created_at":"2015-08-13T13:58:51Z","updated_at":"2015-08-13T13:58:51Z","pushed_at":"2015-09-04T23:41:47Z","git_url":"git://github.com/kg/spec.git","ssh_url":"git@github.com:kg/spec.git","clone_url":"https://github.com/kg/spec.git","svn_url":"https://github.com/kg/spec","homepage":null,"size":256,"stargazers_count":0,"watchers_count":0,"language":"OCaml","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":"WebAssembly:master","ref":"master","sha":"ce645d2a7b44e003c1fe8c66c8cde7a971525c69","user":{"login":"WebAssembly","id":11578470,"avatar_url":"https://avatars.githubusercontent.com/u/11578470?v=3","gravatar_id":"","url":"https://api.github.com/users/WebAssembly","html_url":"https://github.com/WebAssembly","followers_url":"https://api.github.com/users/WebAssembly/followers","following_url":"https://api.github.com/users/WebAssembly/following{/other_user}","gists_url":"https://api.github.com/users/WebAssembly/gists{/gist_id}","starred_url":"https://api.github.com/users/WebAssembly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WebAssembly/subscriptions","organizations_url":"https://api.github.com/users/WebAssembly/orgs","repos_url":"https://api.github.com/users/WebAssembly/repos","events_url":"https://api.github.com/users/WebAssembly/events{/privacy}","received_events_url":"https://api.github.com/users/WebAssembly/received_events","type":"Organization","site_admin":false},"repo":{"id":40598815,"name":"spec","full_name":"WebAssembly/spec","owner":{"login":"WebAssembly","id":11578470,"avatar_url":"https://avatars.githubusercontent.com/u/11578470?v=3","gravatar_id":"","url":"https://api.github.com/users/WebAssembly","html_url":"https://github.com/WebAssembly","followers_url":"https://api.github.com/users/WebAssembly/followers","following_url":"https://api.github.com/users/WebAssembly/following{/other_user}","gists_url":"https://api.github.com/users/WebAssembly/gists{/gist_id}","starred_url":"https://api.github.com/users/WebAssembly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WebAssembly/subscriptions","organizations_url":"https://api.github.com/users/WebAssembly/orgs","repos_url":"https://api.github.com/users/WebAssembly/repos","events_url":"https://api.github.com/users/WebAssembly/events{/privacy}","received_events_url":"https://api.github.com/users/WebAssembly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WebAssembly/spec","description":"Staging ground for artifacts related to an MVP spec","fork":false,"url":"https://api.github.com/repos/WebAssembly/spec","forks_url":"https://api.github.com/repos/WebAssembly/spec/forks","keys_url":"https://api.github.com/repos/WebAssembly/spec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WebAssembly/spec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WebAssembly/spec/teams","hooks_url":"https://api.github.com/repos/WebAssembly/spec/hooks","issue_events_url":"https://api.github.com/repos/WebAssembly/spec/issues/events{/number}","events_url":"https://api.github.com/repos/WebAssembly/spec/events","assignees_url":"https://api.github.com/repos/WebAssembly/spec/assignees{/user}","branches_url":"https://api.github.com/repos/WebAssembly/spec/branches{/branch}","tags_url":"https://api.github.com/repos/WebAssembly/spec/tags","blobs_url":"https://api.github.com/repos/WebAssembly/spec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WebAssembly/spec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WebAssembly/spec/git/refs{/sha}","trees_url":"https://api.github.com/repos/WebAssembly/spec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WebAssembly/spec/statuses/{sha}","languages_url":"https://api.github.com/repos/WebAssembly/spec/languages","stargazers_url":"https://api.github.com/repos/WebAssembly/spec/stargazers","contributors_url":"https://api.github.com/repos/WebAssembly/spec/contributors","subscribers_url":"https://api.github.com/repos/WebAssembly/spec/subscribers","subscription_url":"https://api.github.com/repos/WebAssembly/spec/subscription","commits_url":"https://api.github.com/repos/WebAssembly/spec/commits{/sha}","git_commits_url":"https://api.github.com/repos/WebAssembly/spec/git/commits{/sha}","comments_url":"https://api.github.com/repos/WebAssembly/spec/comments{/number}","issue_comment_url":"https://api.github.com/repos/WebAssembly/spec/issues/comments{/number}","contents_url":"https://api.github.com/repos/WebAssembly/spec/contents/{+path}","compare_url":"https://api.github.com/repos/WebAssembly/spec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WebAssembly/spec/merges","archive_url":"https://api.github.com/repos/WebAssembly/spec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WebAssembly/spec/downloads","issues_url":"https://api.github.com/repos/WebAssembly/spec/issues{/number}","pulls_url":"https://api.github.com/repos/WebAssembly/spec/pulls{/number}","milestones_url":"https://api.github.com/repos/WebAssembly/spec/milestones{/number}","notifications_url":"https://api.github.com/repos/WebAssembly/spec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WebAssembly/spec/labels{/name}","releases_url":"https://api.github.com/repos/WebAssembly/spec/releases{/id}","created_at":"2015-08-12T12:15:16Z","updated_at":"2015-09-05T14:49:41Z","pushed_at":"2015-09-04T23:45:10Z","git_url":"git://github.com/WebAssembly/spec.git","ssh_url":"git@github.com:WebAssembly/spec.git","clone_url":"https://github.com/WebAssembly/spec.git","svn_url":"https://github.com/WebAssembly/spec","homepage":null,"size":1106,"stargazers_count":28,"watchers_count":28,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":11,"forks":8,"open_issues":11,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WebAssembly/spec/pulls/49"},"html":{"href":"https://github.com/WebAssembly/spec/pull/49"},"issue":{"href":"https://api.github.com/repos/WebAssembly/spec/issues/49"},"comments":{"href":"https://api.github.com/repos/WebAssembly/spec/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/WebAssembly/spec/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/WebAssembly/spec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WebAssembly/spec/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/WebAssembly/spec/statuses/458aab99d97cb0e93a91fa623fd200b0c0623903"}}}}