{"id":18952771,"url":"https://github.com/m7moudgadallah/cpp_testing_for_cp","last_synced_at":"2026-03-29T13:30:19.527Z","repository":{"id":66794376,"uuid":"604099588","full_name":"m7moudGadallah/Cpp_Testing_for_CP","owner":"m7moudGadallah","description":"Simple class used to test functionality by passing the result of  function and the expected output","archived":false,"fork":false,"pushed_at":"2023-02-20T11:18:57.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-01T02:41:46.531Z","etag":null,"topics":["competitive-programming","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m7moudGadallah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-02-20T10:34:01.000Z","updated_at":"2023-02-20T11:29:31.000Z","dependencies_parsed_at":"2023-03-16T12:15:15.921Z","dependency_job_id":null,"html_url":"https://github.com/m7moudGadallah/Cpp_Testing_for_CP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FCpp_Testing_for_CP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FCpp_Testing_for_CP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FCpp_Testing_for_CP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7moudGadallah%2FCpp_Testing_for_CP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m7moudGadallah","download_url":"https://codeload.github.com/m7moudGadallah/Cpp_Testing_for_CP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239952598,"owners_count":19723922,"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":["competitive-programming","unit-testing"],"created_at":"2024-11-08T13:34:35.927Z","updated_at":"2026-03-29T13:30:19.449Z","avatar_url":"https://github.com/m7moudGadallah.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testing\r\n\r\n## Content\r\n\r\n- ***[How to include it?](#how-to-include-it)***\r\n- ***[How to use it?](#how-to-use-it)***\r\n\r\n## How to include it?\r\n\r\nFirst download this [file](./UTest.h) and include it in your working directory like that:\r\n\r\n```cpp\r\n    #include \"UTest.h\"\r\n```\r\n\r\n## How to use it?\r\n\r\nin `main` function create object fromt `UTest` class then call function `test` funciton take `vector of  pair` as `input`\r\n`pair\u003cout, exp\u003e` here `out`: output of your function and `exp`: is expected output of your function\r\n\r\n### Example\r\nif we have a function called `sum` and this is it's implemenation\r\n```c++\r\n    int sum(int x, int y) {\r\n        return x+y;\r\n    }\r\n```\r\n\r\nnow we want to test this function and we already have test cases\r\n\r\n```\r\ninput: 1 2\r\nexpected: 3\r\n\r\ninput: 3 4\r\nexpected: 7\r\n```\r\n\r\n```c++\r\n    int main() {\r\n        UTest testObj;\r\n    \r\n        vector\u003cpair\u003cint, int\u003e\u003e testStream {\r\n            make_pair(sum(1, 2), 3),\r\n            make_pair(sum(3, 4), 7)\r\n        };\r\n    \r\n        testObj.test(testStream);\r\n    }\r\n```\r\n\r\n```cpp\r\n    #include \u003cbits/stdc++.h\u003e\r\n    #include \"UTest.h\"\r\n    \r\n    using namespace std;\r\n    \r\n    int sum(int x, int y) {\r\n        return x + y;\r\n    }\r\n    \r\n    int main() {\r\n        UTest testObj;\r\n    \r\n        vector\u003cpair\u003cint, int\u003e\u003e testStream {\r\n            make_pair(sum(1, 2), 3),\r\n            make_pair(sum(3, 4), 7)\r\n        };\r\n    \r\n        testObj.test(testStream);\r\n    }\r\n```\r\n\r\n#### output\r\n\r\n![res](./pic/res.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm7moudgadallah%2Fcpp_testing_for_cp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm7moudgadallah%2Fcpp_testing_for_cp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm7moudgadallah%2Fcpp_testing_for_cp/lists"}