{"id":26446500,"url":"https://github.com/prophetru/privateunittest","last_synced_at":"2025-09-09T18:54:37.530Z","repository":{"id":282561093,"uuid":"948982569","full_name":"ProphetRu/PrivateUnitTest","owner":"ProphetRu","description":"The project demonstrates unit-testing of private methods","archived":false,"fork":false,"pushed_at":"2025-03-15T12:29:07.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T13:23:27.682Z","etag":null,"topics":["cpp","gtest","private","unit-test"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProphetRu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-15T12:09:29.000Z","updated_at":"2025-03-15T12:23:36.000Z","dependencies_parsed_at":"2025-03-15T19:01:04.697Z","dependency_job_id":null,"html_url":"https://github.com/ProphetRu/PrivateUnitTest","commit_stats":null,"previous_names":["prophetru/privateunittest"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProphetRu%2FPrivateUnitTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProphetRu%2FPrivateUnitTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProphetRu%2FPrivateUnitTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProphetRu%2FPrivateUnitTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProphetRu","download_url":"https://codeload.github.com/ProphetRu/PrivateUnitTest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244217950,"owners_count":20417677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","gtest","private","unit-test"],"created_at":"2025-03-18T12:17:59.264Z","updated_at":"2025-03-18T12:17:59.959Z","avatar_url":"https://github.com/ProphetRu.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Private Unit Test\nPrivateUnitTest - The project demonstrates unit-testing of private methods.\n\n## Dependencies\n* [googletest](https://github.com/google/googletest)\n\n## How to use\n### In project\nFor the class under test, add an include only for the test mode:\n```cpp\n#ifdef UNIT_TESTING\n#include \u003cgtest/gtest_prod.h\u003e \n#endif // UNIT_TESTING\n```\n\nInside the class under test, add a macro for test mode only:\n```cpp\n#ifdef UNIT_TESTING\n\tFRIEND_TEST(test_case_name, test_name);\n#endif // UNIT_TESTING\n```\n\n### In test\nInclude the testing class with test macro:\n```cpp\n#define UNIT_TESTING\n#include \"TestClass.h\"\n#include \"TestClass.cpp\" // the linking error without this #include\n#undef UNIT_TESTING\n```\n\nAdd unit-test:\n```cpp\nTEST(test_case_name, test_name)\n{\n    // here you can access to private methods of the class under test\n}\n```\n\n\n## Build local Windows/Linux\n```shell\nvcpkg install gtest\nvcpkg integrate install\n\ncd PrivateUnitTest\nmkdir build \u0026\u0026 cd build\n\ncmake .. -DCMAKE_TOOLCHAIN_FILE=\"path/to/vcpkg/scripts/buildsystems/vcpkg.cmake\"\n\ncmake --build . --config Release\n```\n\n## Testing\n```shell\nctest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprophetru%2Fprivateunittest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprophetru%2Fprivateunittest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprophetru%2Fprivateunittest/lists"}