{"id":19579715,"url":"https://github.com/alphamarket/lizard","last_synced_at":"2025-02-26T12:13:19.733Z","repository":{"id":15596470,"uuid":"18332515","full_name":"alphamarket/lizard","owner":"alphamarket","description":"A easy-to-use, modern, C++-native, header-only and fast test framework for unit-testing, using C++11, C++14, C++17, C++2a.","archived":false,"fork":false,"pushed_at":"2021-06-07T10:19:50.000Z","size":188,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T04:58:34.301Z","etag":null,"topics":["c-plus-plus","cpp11","cpp14","cpp17","cpp20","demo","framework","header-only","lizard","modern-cpp","no-dependencies","test-automation","test-driven-development","test-unit","testframework","testing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alphamarket.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}},"created_at":"2014-04-01T14:35:49.000Z","updated_at":"2021-06-07T10:22:25.000Z","dependencies_parsed_at":"2022-08-25T08:40:28.421Z","dependency_job_id":null,"html_url":"https://github.com/alphamarket/lizard","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphamarket%2Flizard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphamarket%2Flizard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphamarket%2Flizard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphamarket%2Flizard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alphamarket","download_url":"https://codeload.github.com/alphamarket/lizard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240849058,"owners_count":19867617,"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":["c-plus-plus","cpp11","cpp14","cpp17","cpp20","demo","framework","header-only","lizard","modern-cpp","no-dependencies","test-automation","test-driven-development","test-unit","testframework","testing"],"created_at":"2024-11-11T07:18:32.528Z","updated_at":"2025-02-26T12:13:19.664Z","avatar_url":"https://github.com/alphamarket.png","language":"C++","readme":"Lizard\n===\n\nA lightweight and efficient C++ testing package.\n\nDemo\n---\n![lizard C++ testing package demo](demo.gif)\n\n\n```bash\ngit clone https://github.com/alphamarket/lizard.git\ncd lizard\nmkdir build \u0026\u0026 cd build\ncmake .. \u0026\u0026 make\n./test\n```\n\n```c++\n// lizard/tests/sample_tester.hpp\n#pragma once\n\n#include \"lizard/tester.hpp\"\n\nTEST(sample_tester, \"Tester/Sample\",\n    int some_var_to_use_inside_specs = 1;\n\n    void tester_method() const;\n) {\n    // onstart(\"A label for it\", []() {\n    //     std::cout \u003c\u003c std::endl \u003c\u003c \"BEFORE ANY SPEC GOT STARTED!\" \u003c\u003c std::endl;\n    // });\n\n    // onterminate(\"A label for it\", []() {\n    //     std::cout \u003c\u003c std::endl \u003c\u003c \"AFETR ALL SPECs GOT FINISHED!\" \u003c\u003c std::endl;\n    // });\n\n    // prespec(\"A label for it\", [](auto name) {\n    //     std::cout \u003c\u003c std::endl \u003c\u003c \"STARTING SPEC: \" \u003c\u003c name \u003c\u003c std::endl;\n    // });\n\n    // postspec(\"A label for it\", [](auto name) {\n    //     std::cout \u003c\u003c std::endl \u003c\u003c \"FINISHED SPEC: \" \u003c\u003c name \u003c\u003c std::endl;\n    // });\n\n    spec(\"sum\", [\u0026]() {\n        IS_EQUAL(some_var_to_use_inside_specs++ + 2, 3);\n    });\n\n    spec(\"multiply\", []() {\n        SKIP_WITH_MESSAGE(\"SKIP WITH MESSAGE\");\n    });\n\n    spec(\"minus\", [\u0026]() {\n        IS_ZERO(some_var_to_use_inside_specs - 2);\n    });\n\n    spec(\"faulty\", []() {\n        IS_EQUAL(2 / 2, -1);\n    });\n\n    spec(\"divide\", [\u0026]() {\n        tester_method();\n        IS_EQUAL(2 / 2, 1);\n    });\n}\n\nvoid LIZARD_TESTER_METHOD(sample_tester, tester_method)() const {\n    std::cout \u003c\u003c \"Tester method got called!\\n\";\n}\n```\n\nEvent handlers\n---\nYou can set some event handlers to catch up with the testing procedures, The list of events is as follow:\n\n| Event | Description | Callback Signature |\n|-------|-------------|--------------------|\n| `onstart` | Get called before starting any `spec` unit (right at the begining of the test unit.) -- suitable to loading resources before test unit. | `std::function\u003cvoid()\u003e`  |\n| `onterminate` | Get called after `spec`s are done (right at the terminating the test unit / regardless of the termination status.) -- suitable to releasing resources at the end of test unit. | `std::function\u003cvoid()\u003e` |\n| `prespec` | Get invoked right before a `spec` get started. The callback function's arguments are the `name` of the spec is going to get executed -- suitable to loading resources at the start of each `spec`. | `std::function\u003cvoid(const std::string\u0026)\u003e` |\n| `postspec` | Get invoked right after a `spec` get *finished* / *skipped* / *failed*. The callback function's arguments are the `name` of the spec dealt with -- suitable to releasing resources at the end of each `spec`. | `std::function\u003cvoid(const std::string\u0026)\u003e` |\n\nPrerequisites\n---\nNo prerequisites is needed. The project is as is.\n\nHow to step up in your project?\n-----\nAssume you have a project named `cppApp` written in C++.\n\nThere is a [setup script](https://raw.githubusercontent.com/alphamarket/lizard/master/lizard-setup) provided to make cloning this C++ Tester repository into your project easier\n\n```BASH\ncd \"/path/to/cppApp\"\ncurl https://raw.githubusercontent.com/alphamarket/lizard/master/lizard-setup | bash\n# That is it.\ncd test\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphamarket%2Flizard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphamarket%2Flizard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphamarket%2Flizard/lists"}