{"id":50731460,"url":"https://github.com/cakilgan/lextest","last_synced_at":"2026-06-10T09:01:43.603Z","repository":{"id":352414805,"uuid":"1214703448","full_name":"cakilgan/lextest","owner":"cakilgan","description":"easy to use basic test framework","archived":false,"fork":false,"pushed_at":"2026-05-17T18:23:21.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-17T20:38:36.313Z","etag":null,"topics":["test","testing","testing-library","testing-tools"],"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/cakilgan.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-18T23:46:56.000Z","updated_at":"2026-05-17T18:23:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cakilgan/lextest","commit_stats":null,"previous_names":["cakilgan/lextest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cakilgan/lextest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakilgan%2Flextest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakilgan%2Flextest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakilgan%2Flextest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakilgan%2Flextest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cakilgan","download_url":"https://codeload.github.com/cakilgan/lextest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakilgan%2Flextest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34144680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["test","testing","testing-library","testing-tools"],"created_at":"2026-06-10T09:01:42.471Z","updated_at":"2026-06-10T09:01:43.589Z","avatar_url":"https://github.com/cakilgan.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lextest\n\nLightweight C++ test framework. Header + single translation unit, no dependencies.\n\n---\n\n## Integration\n\nCopy the `lextest/` folder into your project, then in your `CMakeLists.txt`:\n\n```cmake\nadd_subdirectory(lextest)\ninclude(lextest/cmake/lextest.cmake)\n\nlx_add_test(example-1 test1.cpp)\n```\n\nThat's it. Each test target gets its own executable with an entrypoint provided automatically via `entrypoint.cpp`.\n\n\u003e **Note:** The CMake function is `lx_add_test` (singular), not `lx_add_tests` , this means it generates 1 target with multiple files.\n\n---\n\n## Writing Tests\n\n```cpp\n#include \u003clextest.h\u003e\n\nLXTEST(Math, Addition, \"basic arithmetic\") {\n    int a = 2, b = 3;\n    LXEQ(a + b, 5);\n    LXGT(b, a);\n    LXRETURN;\n}\n```\n\n`LXTEST(category, name, description)` registers the test at startup. Use `LXRETURN` to exit early — it expands to `return lx::test_result::pass`.\n\n---\n\n## Assertions\n\nAll assertions are **non-fatal** — the test continues after a failure and all events are reported.\n\n| Macro | Check |\n|---|---|\n| `LXEQ(a, b)` | `a == b` |\n| `LXNEQ(a, b)` | `a != b` |\n| `LXGT(a, b)` | `a \u003e b` |\n| `LXLT(a, b)` | `a \u003c b` |\n| `LXGE(a, b)` | `a \u003e= b` |\n| `LXLE(a, b)` | `a \u003c= b` |\n| `LXTRUE(x)` | `x == true` |\n| `LXFALSE(x)` | `x == false` |\n| `LXNULL(x)` | `x == nullptr` |\n| `LXSTREQ(a, b)` | `std::string(a) == std::string(b)` |\n| `LXSTRNEQ(a, b)` | `std::string(a) != std::string(b)` |\n\n---\n\n## Event Modifiers\n\nEvent modifiers are placed **before** an assertion macro on the same line.\n\n### `LXSKIP` — Skip an event\n\nThe assertion is not evaluated or counted. A skip message appears in the log.\n\n```cpp\nLXTEST(Feature, example, \"skip demo\") {\n    LXSKIP LXGE(5, 12);  // not evaluated, not counted\n    LXRETURN;\n}\n```\n\n```\n  SKIP: skipping this event... (5 \u003e= 12)\n```\n\n`event.control.skipped` will be `true`.\n\n---\n\n### `LXDEPRECATED` — Deprecate an event\n\nThe assertion **is** evaluated and counted, but a warning is printed. Useful for tracking assertions you intend to remove.\n\n```cpp\nLXTEST(Feature, example, \"deprecated demo\") {\n    LXDEPRECATED LXGE(5, 12);  // evaluated, warning shown\n    LXRETURN;\n}\n```\n\n```\n  WARN: this event is deprecated. (5 \u003e= 12)\n  $    5 \u003e= 12\n  FAIL    5 \u003e= 12\n```\n\n`event.control.deprecated` will be `true`.\n\n---\n\n## Skipping Tests\n\nTo skip an entire test, use `LXSKIPTEST(result)` as the first statement:\n\n```cpp\nLXTEST(Feature, not_ready, \"wip\") {\n    LXSKIPTEST(pass);  // skip, assume pass\n}\n\nLXTEST(Feature, known_bug, \"wip\") {\n    LXSKIPTEST(fail);  // skip, assume fail\n}\n```\n\nSkipped tests appear in the summary but do not run.\n\n---\n\n## CLI Options\n\n```\n--no-color        Disable ANSI color output\n--color           Enable ANSI color output (default)\n\n--list            List tests without running them\n--verbose         Show descriptions, file locations, expression details and verbose summary\n--filter=CATEGORY Run only tests in the given category\n\n--fail-fast       Stop a test after the first failing assertion\n\n--json            Converts all test data to json\n--json-pretty     Makes json data indented and human readable (flag --json must be present)\n```\n\nExample:\n\n```sh\n./my-tests --filter=Math --verbose\n./my-tests --no-color --fail-fast\n```\n\n---\n\n## Output\n\n### With --list option\n\u003cimg width=\"1148\" height=\"427\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f3804b15-e4ab-4004-9f51-02f8478f13dd\" /\u003e\n\n### Default options \n\u003cimg width=\"757\" height=\"827\" alt=\"image\" src=\"https://github.com/user-attachments/assets/6843fbdf-999b-43fd-bc97-47d40abacf3a\" /\u003e\n\n### With --verbose option\n\u003cimg width=\"347\" height=\"953\" alt=\"image\" src=\"https://github.com/user-attachments/assets/b85f0c4d-a9fb-4f6d-a1a0-faf25951fbcf\" /\u003e\n\n### Deprecate And Skip\n\u003cimg width=\"840\" height=\"151\" alt=\"image\" src=\"https://github.com/user-attachments/assets/046a50f9-a79e-45ee-84ad-62bcbf78cfcc\" /\u003e\n\n### Test Skip\n\u003cimg width=\"646\" height=\"90\" alt=\"image\" src=\"https://github.com/user-attachments/assets/c043c6cd-ec00-4f0c-a520-801e729c92b3\" /\u003e\n\n---\n\n## Custom Type Stringification\n\nThe `lx::detail::to_string_any` template function is used to format assertion values. You can specialize it for your own types:\n\n```cpp\nnamespace lx::detail {\n    template \u003c\u003e\n    std::string to_string_any(const MyType\u0026 value) {\n        return value.to_string();\n    }\n}\n```\n\n---\n\n## JSON Output\n\n\n---\n\n## Requirements\n\n- C++17\n- CMake 3.20+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakilgan%2Flextest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcakilgan%2Flextest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakilgan%2Flextest/lists"}