{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments/67746422","id":67746422,"diff_hunk":"@@ -0,0 +1,462 @@\n+#include \"catch.hpp\"\n+\n+#include <bson_mapper/bson_archiver.hpp>\n+#include <cereal/types/vector.hpp>\n+#include <fstream>\n+\n+/**\n+ * Returns true if the two files are identical, false otherwise.\n+ */\n+bool file_cmp(std::string filename1, std::string filename2) {\n+    std::ifstream file1(filename1, std::ios_base::binary);\n+    std::ifstream file2(filename2, std::ios_base::binary);\n+\n+    file1.seekg(0, file1.end);\n+    file2.seekg(0, file2.end);\n+\n+    size_t file1_length = file1.tellg();\n+    size_t file2_length = file2.tellg();\n+\n+    file1.seekg(0, file1.beg);\n+    file2.seekg(0, file2.beg);\n+\n+    if (file1_length != file2_length) {\n+        return false;\n+    }\n+\n+    char file1buf[file1_length], file2buf[file2_length];\n+\n+    file1.read(file1buf, file1_length);\n+    file2.read(file2buf, file2_length);\n+\n+    return std::memcmp(file1buf, file2buf, file1_length) == 0;\n+}\n+\n+/**\n+ * Counts the number of keys in a particular document view.\n+ *\n+ * @param v\n+ *      the bsoncxx::document::view to count keys in.\n+ *\n+ * @return the number of keys in the view.\n+ */\n+size_t countKeys(bsoncxx::document::view v) {\n+    size_t count = 0;\n+    for (auto elem = v.begin(); elem != v.end(); ++elem) {\n+        ++count;\n+        // DEBUG: std::cout << \" key: \" << elem->key() << \"\\n\";\n+    }\n+    return count;\n+}\n+\n+struct DataA {\n+    int32_t x, y;\n+    double z;\n+\n+    template <class Archive>\n+    void serialize(Archive& ar) {\n+        ar(CEREAL_NVP(x), CEREAL_NVP(y), CEREAL_NVP(z));\n+    }\n+\n+    bool operator==(const DataA& other) {\n+        return x == other.x && y == other.y && z == other.z;","path":"src/bson_mapper/test/archiver_test.cpp","position":62,"original_position":62,"commit_id":"32c5e752a76f8102263af7fcaea0cd8742ce82b9","original_commit_id":"32c5e752a76f8102263af7fcaea0cd8742ce82b9","user":{"login":"adamchel","id":1976694,"avatar_url":"https://avatars.githubusercontent.com/u/1976694?v=3","gravatar_id":"","url":"https://api.github.com/users/adamchel","html_url":"https://github.com/adamchel","followers_url":"https://api.github.com/users/adamchel/followers","following_url":"https://api.github.com/users/adamchel/following{/other_user}","gists_url":"https://api.github.com/users/adamchel/gists{/gist_id}","starred_url":"https://api.github.com/users/adamchel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamchel/subscriptions","organizations_url":"https://api.github.com/users/adamchel/orgs","repos_url":"https://api.github.com/users/adamchel/repos","events_url":"https://api.github.com/users/adamchel/events{/privacy}","received_events_url":"https://api.github.com/users/adamchel/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-06-20T18:58:27Z","updated_at":"2016-06-20T18:58:27Z","html_url":"https://github.com/mongodb/mongo-cxx-odm/pull/3#discussion_r67746422","pull_request_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments/67746422"},"html":{"href":"https://github.com/mongodb/mongo-cxx-odm/pull/3#discussion_r67746422"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3","id":73429021,"html_url":"https://github.com/mongodb/mongo-cxx-odm/pull/3","diff_url":"https://github.com/mongodb/mongo-cxx-odm/pull/3.diff","patch_url":"https://github.com/mongodb/mongo-cxx-odm/pull/3.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/3","number":3,"state":"open","locked":false,"title":"Preliminary BSON archiver","user":{"login":"adamchel","id":1976694,"avatar_url":"https://avatars.githubusercontent.com/u/1976694?v=3","gravatar_id":"","url":"https://api.github.com/users/adamchel","html_url":"https://github.com/adamchel","followers_url":"https://api.github.com/users/adamchel/followers","following_url":"https://api.github.com/users/adamchel/following{/other_user}","gists_url":"https://api.github.com/users/adamchel/gists{/gist_id}","starred_url":"https://api.github.com/users/adamchel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamchel/subscriptions","organizations_url":"https://api.github.com/users/adamchel/orgs","repos_url":"https://api.github.com/users/adamchel/repos","events_url":"https://api.github.com/users/adamchel/events{/privacy}","received_events_url":"https://api.github.com/users/adamchel/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-10T20:10:41Z","updated_at":"2016-06-20T18:58:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25a53aedf7c8a2b60a62afd498fe430fbc1d7d3e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/3/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/32c5e752a76f8102263af7fcaea0cd8742ce82b9","head":{"label":"mongodb:bson_archiver","ref":"bson_archiver","sha":"32c5e752a76f8102263af7fcaea0cd8742ce82b9","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":60376659,"name":"mongo-cxx-odm","full_name":"mongodb/mongo-cxx-odm","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/mongo-cxx-odm","description":"","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm","forks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/deployments","created_at":"2016-06-03T20:45:42Z","updated_at":"2016-06-09T15:35:42Z","pushed_at":"2016-06-20T14:53:51Z","git_url":"git://github.com/mongodb/mongo-cxx-odm.git","ssh_url":"git@github.com:mongodb/mongo-cxx-odm.git","clone_url":"https://github.com/mongodb/mongo-cxx-odm.git","svn_url":"https://github.com/mongodb/mongo-cxx-odm","homepage":null,"size":397,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"mongodb:master","ref":"master","sha":"a3e47b7d13c86d667410e2500f0d5bebdc8c05eb","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":60376659,"name":"mongo-cxx-odm","full_name":"mongodb/mongo-cxx-odm","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/mongo-cxx-odm","description":"","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-cxx-odm","forks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/mongo-cxx-odm/deployments","created_at":"2016-06-03T20:45:42Z","updated_at":"2016-06-09T15:35:42Z","pushed_at":"2016-06-20T14:53:51Z","git_url":"git://github.com/mongodb/mongo-cxx-odm.git","ssh_url":"git@github.com:mongodb/mongo-cxx-odm.git","clone_url":"https://github.com/mongodb/mongo-cxx-odm.git","svn_url":"https://github.com/mongodb/mongo-cxx-odm","homepage":null,"size":397,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3"},"html":{"href":"https://github.com/mongodb/mongo-cxx-odm/pull/3"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/3"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-cxx-odm/statuses/32c5e752a76f8102263af7fcaea0cd8742ce82b9"}}}}
{"actor":{"display_login":"adamchel"}}