{"id":22422106,"url":"https://github.com/abumq/testx","last_synced_at":"2025-03-27T05:22:51.319Z","repository":{"id":148853227,"uuid":"101817718","full_name":"abumq/testx","owner":"abumq","description":"Extremely simple header-only library to create typesafe test data for your C++ application.","archived":false,"fork":false,"pushed_at":"2023-06-03T07:28:19.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-01T10:27:41.244Z","etag":null,"topics":["cpp11","integration-testing","testing-tools","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abumq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-08-29T23:58:49.000Z","updated_at":"2024-04-05T22:36:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"e0bec107-08c6-44c8-adab-e6d7c13b2fa6","html_url":"https://github.com/abumq/testx","commit_stats":null,"previous_names":["abumq/testx"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Ftestx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Ftestx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Ftestx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abumq%2Ftestx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abumq","download_url":"https://codeload.github.com/abumq/testx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245786716,"owners_count":20671796,"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","integration-testing","testing-tools","unit-testing"],"created_at":"2024-12-05T17:11:44.905Z","updated_at":"2025-03-27T05:22:51.299Z","avatar_url":"https://github.com/abumq.png","language":"C++","readme":"﷽\n\n# Overview\nTestX is extremely simple header to create typesafe test data.\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/abumq/testx/blob/master/LICENSE)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://amrayn.com/donate)\n\n# Usage\n\nYou can see practical usage on residue tests [basic](https://github.com/abumq/residue/blob/develop/test/utils-test.h#L65) and [using wrapper](https://github.com/abumq/residue/blob/develop/test/url-test.h)\n\n```c++\n#include \u003ctestx.h\u003e\n\nusing namespace testx;\n\n//              c    expected\nstatic TestData\u003cchar, bool\u003e IsDigitTestData = {\n  { '1', true },\n  { 'a', false },\n}\n```\n\nYou can use `std::get` to get item without specifying the type\n\n```c++\nvoid testNumber() {\n    for (auto\u0026 item : IsDigitTestData) {\n        auto c = item.get\u003c0\u003e();\n        bool expected = item.get\u003c1\u003e();\n        assert(isdigit(c) == expected));\n    }\n\n}\n```\n\n# Explicit Type\nYou can specify the test case type and re-use it using wrapper types (`TestDataW` and `TestCaseW`)\n\n```\n    \nusing URLTestCase = TestCase\u003cstd::string, std::string, std::string, std::string, std::string, std::string\u003e;\n \n        // Notice the TestDataW instead of TestData\n        // if we used TestData we would do:\n        //         TestData\u003cstd::string, std::string, std::string, std::string, std::string, std::string\u003e\nstatic TestDataW\u003cURLTestCase\u003e URLTestData = {\n    { \"https://192.168.1.100:3322/p1?q=1\", \"https\", \"192.168.1.100\", \"3322\", \"/p1\", \"q=1\" },\n    { \"http://192.168.1.19:3000/p2?q2=2\", \"http\", \"192.168.1.19\", \"3000\", \"/p2\", \"q2=2\" },\n    { \"HTTP://LOCALHOST:3000/PATH?QUERY1=1\u0026QUERY2=2\", \"HTTP\", \"LOCALHOST\", \"3000\", \"/PATH\", \"QUERY1=1\u0026QUERY2=2\" },\n    { \"http://localhost:3000/path?query1=1\u0026query2=2\", \"http\", \"localhost\", \"3000\", \"/path\", \"query1=1\u0026query2=2\" },\n    { \"http://localhost\", \"http\", \"localhost\", \"80\", \"\", \"\" },\n    { \"http://localhost:3000\", \"http\", \"localhost\", \"3000\", \"\", \"\" },\n    { \"http://localhost:3000/\", \"http\", \"localhost\", \"3000\", \"/\", \"\" },\n    { \"localhost:3000/\", \"http\", \"localhost\", \"3000\", \"/\", \"\" },\n    { \"localhost\", \"http\", \"localhost\", \"80\", \"\", \"\" },\n    { \"http://localhost\", \"http\", \"localhost\", \"80\", \"\", \"\" },\n    { \"https://localhost\", \"https\", \"localhost\", \"443\", \"\", \"\" },\n    { \"localhost/\", \"http\", \"localhost\", \"80\", \"/\", \"\" },\n    { \"HTTP://LOCALHOST:3000/PATH?QUERY1=1\u0026QUERY2=2\", \"HTTP\", \"LOCALHOST\", \"3000\", \"/PATH\", \"QUERY1=1\u0026QUERY2=2\"},\n\n};\n\nvoid testUrl(const Url\u0026 url, const URLTestCase\u0026 item) // using URLTestCase that was previously defined\n{\n    ASSERT_EQ(url.protocol(), item.get\u003c1\u003e());\n    ASSERT_EQ(url.host(), item.get\u003c2\u003e());\n    ASSERT_EQ(url.port(), item.get\u003c3\u003e());\n    ASSERT_EQ(url.path(), item.get\u003c4\u003e());\n    ASSERT_EQ(url.query(), item.get\u003c5\u003e());\n    ASSERT_TRUE(url.isValid());\n}\n\nTEST(UrlTest, TestUrls)\n{\n    for (const auto\u0026 item : URLTestData) {\n        Url url(item.get\u003c0\u003e());\n        testUrl(url, item);\n    }\n}\n```\n\n# License\n```\nThe MIT License (MIT)\n\nCopyright (c) 2017-present @abumq (Majid Q.)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabumq%2Ftestx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabumq%2Ftestx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabumq%2Ftestx/lists"}