{"id":23139765,"url":"https://github.com/christopherbate/quicktestcpp","last_synced_at":"2025-04-04T10:13:25.048Z","repository":{"id":116155386,"uuid":"152903012","full_name":"christopherbate/QuickTestCPP","owner":"christopherbate","description":"QuickTestCPP - A lightweight C++ unit testing header library.","archived":false,"fork":false,"pushed_at":"2020-05-10T22:10:55.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T20:36:22.589Z","etag":null,"topics":["cpp11","header-library","simple","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christopherbate.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":"2018-10-13T18:37:59.000Z","updated_at":"2020-05-10T22:10:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"87953fde-014d-4cee-bb39-8b5c34437d91","html_url":"https://github.com/christopherbate/QuickTestCPP","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/christopherbate%2FQuickTestCPP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherbate%2FQuickTestCPP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherbate%2FQuickTestCPP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherbate%2FQuickTestCPP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christopherbate","download_url":"https://codeload.github.com/christopherbate/QuickTestCPP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157287,"owners_count":20893221,"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":["cpp11","header-library","simple","unit-testing"],"created_at":"2024-12-17T13:14:49.960Z","updated_at":"2025-04-04T10:13:25.038Z","avatar_url":"https://github.com/christopherbate.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## QuickTestCPP\n\nQuickTestCPP is a lightweight header-only tool for quickly developing unit tests in C++ (11). I created this to for projects that requried unit tests, but for whatever reason bringing in a larger testing library was out of the question. I modeled the terminology after Google Tests's terminology. A \"test\" is an individual test, and a \"test case\" is a set of tests. We keep the syntax relatively lightweight by leveraging C++ lambda functions. The whole idea is relatively simple, as shown in the below examples. Create the tests with lambda functions, and return true or 1 on success, 0 or false on failure. At the end, call the print summary for a description. \n\n## Example usage.\n\n\n~~~~\n#include \"QuickTestCPP.h\"\n#include \u003ciostream\u003e\n[other includes]\n\nint main(int argc, char **argv)\n{\n    std::cout \u003c\u003c \"Starting tests.\" \u003c\u003c std::endl;\n\n    TestRunner::GetRunner()-\u003eAddTest(\n        \"HTTP Request Parsing\",\n        \"Must parse protocol version\",\n        []() {\n            string hdr = \"GET /Protocols/rfc1945/rfc1945 HTTP/1.1\";\n            HTTPRequest request(hdr);\n            if (request.GetProtocol() != \"HTTP/1.1\")\n                return 0;\n            return 1;\n        });\n\n    TestRunner::GetRunner()-\u003eAddTest(\n        \"HTTP Request Parsing\",\n        \"Must parse url\",\n        []() {\n            string hdr = \"GET /Protocols/rfc1945/rfc1945 HTTP/1.1\";\n            HTTPRequest request(hdr);\n            if (request.GetUrl() != \"/Protocols/rfc1945/rfc1945\")\n                return 0;\n            return 1;\n        });\n\n    TestRunner::GetRunner()-\u003eAddTest(\n        \"TCP Socket Creation\",\n        \"Must be able to accept connections\",\n        []() {\n            TCPSocket socket;\n\n            bool res = socket.CreateSocket(\"8080\");\n            if (!res)\n            {\n                std::cerr \u003c\u003c \"Failed to create list socket.\" \u003c\u003c endl;\n                return 0;\n            }\n\n            socket.Listen();\n\n            TCPSocket connSocket;\n            res = connSocket.CreateSocket(\"localhost\", \"8080\");\n            if (!res)\n            {\n                std::cerr \u003c\u003c \"Failed to create active socket.\" \u003c\u003c endl;\n                return 0;\n            }\n\n            TCPSocket *connection = socket.Accept();\n\n            if(connection == NULL){\n                std::cerr \u003c\u003c\"Did not accept connection\"\u003c\u003cendl;\n                return 0;\n            }\n\n            delete connection;\n\n            connSocket.ISocket::CloseSocket();\n            socket.ISocket::CloseSocket();\n            return 1;\n        });\n\n    TestRunner::GetRunner()-\u003eRun();\n\n    TestRunner::GetRunner()-\u003ePrintSummary();\n\n    return TestRunner::GetRunner()-\u003eGetRetCode();\n}\n~~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherbate%2Fquicktestcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristopherbate%2Fquicktestcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherbate%2Fquicktestcpp/lists"}