{"id":17094103,"url":"https://github.com/pk-cod3ch3mist/zolomon","last_synced_at":"2025-07-23T08:05:18.059Z","repository":{"id":198251476,"uuid":"398524740","full_name":"PK-cod3ch3mist/Zolomon","owner":"PK-cod3ch3mist","description":"A single header unit testing library for C++","archived":false,"fork":false,"pushed_at":"2022-10-14T09:53:28.000Z","size":1233,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T22:54:34.183Z","etag":null,"topics":["cpp","cpp-library","cpp17","hacktoberfest","header-only","testing-library"],"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/PK-cod3ch3mist.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}},"created_at":"2021-08-21T10:05:50.000Z","updated_at":"2022-10-14T10:03:29.000Z","dependencies_parsed_at":"2023-10-05T02:10:09.229Z","dependency_job_id":null,"html_url":"https://github.com/PK-cod3ch3mist/Zolomon","commit_stats":null,"previous_names":["pk-cod3ch3mist/zolomon"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PK-cod3ch3mist/Zolomon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PK-cod3ch3mist%2FZolomon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PK-cod3ch3mist%2FZolomon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PK-cod3ch3mist%2FZolomon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PK-cod3ch3mist%2FZolomon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PK-cod3ch3mist","download_url":"https://codeload.github.com/PK-cod3ch3mist/Zolomon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PK-cod3ch3mist%2FZolomon/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266640796,"owners_count":23960804,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","cpp-library","cpp17","hacktoberfest","header-only","testing-library"],"created_at":"2024-10-14T14:10:17.190Z","updated_at":"2025-07-23T08:05:17.994Z","avatar_url":"https://github.com/PK-cod3ch3mist.png","language":"C++","readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/PK-cod3ch3mist/Zolomon\"\u003e\u003cimg src=\"./zolomon.png\" alt=\"Zolomon\" width=\"450px\"\u003e\u003c/a\u003e\u003c/p\u003e\nAnother single header testing library for C++.\n\n![Lines of code](https://img.shields.io/tokei/lines/github/PK-cod3ch3mist/Zolomon)\n![GitHub issues](https://img.shields.io/github/issues/PK-cod3ch3mist/Zolomon)\n![GitHub Repo stars](https://img.shields.io/github/stars/PK-cod3ch3mist/Zolomon)\n![GitHub last commit](https://img.shields.io/github/last-commit/PK-cod3ch3mist/Zolomon)\n\n\n## Contents\n\n- [About](#about)\n- How to Use\n    - [Installation](#installation-and-set-up)\n    - [Quick Start](#a-simple-example)\n\n## About\nZolomon is  a single header testing library for C++, that reports file and line number in case of error, and can be used to create unit tests\n\nThe name is inspired from the DC character Zoom, who creates tragic situations for heroes to make them better. Similar to what you can do to your programs using the library.\n\n## How to Use\n### Installation and Set Up\nSimply download the [header file](https://raw.githubusercontent.com/PK-cod3ch3mist/Zolomon/main/zolomon.hpp?token=ANHLDA6AV5SHVJRQVTHP4NTBFIGVY) and place it along with your project, and use as you would use any other C++ library. Use the namespace zoln when declaring test cases.\n\n### A Simple Example\nBelow is a simple file that demonstrates the use of Zolomon library.\n```c++\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n#include \"zolomon.hpp\"\n\nint main(int argc, char* argv[])\n{\n    std::vector\u003cint\u003e v = {1, 2, 0, 3, 0, 1, 4, 2, 1};\n    zoln::parse_args(argc, argv);\n    zoln::TestCollection Test1(\"Sample Test 1\", {\n        zoln::TestCase(\"Test Case 1\", v[0], 1, true),\n        zoln::TestCase(\"Test Case 2\", v[2], 0, true)\n    });\n    zoln::TestCollection Test2(\"Sample Test 2\", {\n        zoln::TestCase(\"Test Case 1\", v[0] + v[1], 2, true),\n        zoln::TestCase(\"Test Case 2\", v[0] + v[1], 3, true)\n    });\n    Test1.run_collection();\n    Test2.run_collection();\n    zoln::end_report();\n    return 0;\n}\n```\n`zoln::TestCase` is the basic block of the library which has the parameters: `name`, `actual value`, `expected value` and `show`/`hide` respectively. The `name` is the name of the test case, `actual value` and `expected value` are what you want to check and `show` is a boolean which is true if you want to show and false if you want to hide the result of that test.\n\n**Note that hidden test cases are also run, just not shown.**\n\nCompiling the above code and running the executable (with argument `-p`) would give the following output.\n\n![Simple Eg Output](https://raw.githubusercontent.com/PK-cod3ch3mist/Zolomon/main/simple.png)\n\nRunning with arguments `-p`, `-html` gives the output shown in [testlog.html](./testlog.html) file (available for [preview](https://htmlpreview.github.io/?https://github.com/PK-cod3ch3mist/Zolomon/blob/main/testlog.html))\n\n**Note that arguments can also be passed in the `run_collection()` function, where they override the console arguments for the particular `TestCollection`**\n\nThe strings passed while running are:\n- \\-d : show run time of test cases\n- \\-p : show passed test cases\n- \\-nd : do not show run time of test cases\n- \\-np : do not show passed test cases\n- \\-ft : show time for failed test\n- \\-nft : do not show time for failed tests\n\n**The order of the arguments when running a test collection does not matter.**\n\n### A More Sophisticated Example\n\nThe following program, when given an array of integers, returns a new array such that each number at index i of the new array is the product of all the numbers in original array except the one at index i. Zolomon is used to test this program.\n\n**Note that in case of compound types the library does not show actual and expected variables.** This is being worked upon and will be available in the future.\n\n```c++\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n#include \"zolomon.hpp\"\n\nstd::vector\u003cint\u003e prodVectorNoDivision(std::vector\u003cint\u003e \u0026nums)\n{\n    std::vector\u003clong int\u003e prefix(nums.size());\n    std::vector\u003clong int\u003e suffix(nums.size());\n    std::vector\u003cint\u003e result(nums.size());\n\n    prefix[0] = 1;\n    suffix.back() = 1;\n\n    for (int i = 1; i \u003c nums.size(); i++) {\n        prefix[i] = nums[i - 1] * prefix[i - 1];\n    }\n    for (int i = nums.size() - 2; i \u003e= 0; i--) {\n        suffix[i] = nums[i + 1] * suffix[i + 1];\n    }\n    for (int i = 0; i \u003c result.size(); i++) {\n        result[i] = prefix[i] * suffix[i];\n    }\n    return result;\n}\n\nint main(int argc, char* argv[])\n{\n    std::vector\u003cint\u003e nums1 = {1, 2, 2, 3, 1};\n    std::vector\u003cint\u003e nums2 = {0, 1, 2, 1, 2};\n\n    zoln::parse_args(argc, argv);\n    zoln::TestCollection Test1(\"Sample Test\", {\n        zoln::TestCase(\"Basic Test\", prodVectorNoDivision(nums1), std::vector\u003cint\u003e({12, 6, 6, 4, 12}), true),\n        zoln::TestCase(\"Handling Zeroes\", prodVectorNoDivision(nums2), std::vector\u003cint\u003e({4, 0, 0, 0, 0}), true)\n    });\n\n    Test1.run_collection(\"-p -d\");\n    zoln::end_report();\n    return 0;\n}\n```\n\nThis returns the following output.\n\n![Sophisticated Example](https://raw.githubusercontent.com/PK-cod3ch3mist/Zolomon/main/sophisticated.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpk-cod3ch3mist%2Fzolomon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpk-cod3ch3mist%2Fzolomon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpk-cod3ch3mist%2Fzolomon/lists"}