{"id":40081276,"url":"https://github.com/nsauzede/.ut","last_synced_at":"2026-01-19T09:07:44.019Z","repository":{"id":268723318,"uuid":"892177918","full_name":"nsauzede/.ut","owner":"nsauzede","description":"Simple and fast Unit Test framework / Tooling","archived":false,"fork":false,"pushed_at":"2026-01-10T21:44:51.000Z","size":171,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T06:37:30.562Z","etag":null,"topics":["tdd","test","tooling","unit","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nsauzede.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-21T16:35:09.000Z","updated_at":"2026-01-10T21:44:54.000Z","dependencies_parsed_at":"2024-12-18T14:49:42.190Z","dependency_job_id":"4f455a4d-b6e4-4c60-b217-dd5d13258a8e","html_url":"https://github.com/nsauzede/.ut","commit_stats":null,"previous_names":["nsauzede/.ut"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nsauzede/.ut","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2F.ut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2F.ut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2F.ut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2F.ut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nsauzede","download_url":"https://codeload.github.com/nsauzede/.ut/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsauzede%2F.ut/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28565001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["tdd","test","tooling","unit","unit-testing"],"created_at":"2026-01-19T09:07:43.221Z","updated_at":"2026-01-19T09:07:44.012Z","avatar_url":"https://github.com/nsauzede.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UT\n[![Build Status][WorkflowBadgeLinux]][WorkflowUrl] [![Build Status][WorkflowBadgeWindows]][WorkflowUrl]\n\n![Cle d'UT](res/images/ut.png)\n\n## Simple And Fast Unit Test Framework.\n\nThe goal is to accelerate the Test Driven Development methodology.\n\nIt supports `Linux` and `Windows` (msys2), and is primarily focused on `C/C++`, under the form of a single header file,\nand is meant to be completely independent to the user's existing build system,\nusing a set a convenience tools to automate the building and running of the tests.\nHence, it is de-facto compatible with any text editor/IDE (VSCode, Vi, Emacs, Midnight-commander, ...).\nFunctional Github action pipeline example (Linux and Windows) is provided for easy deployement.\nMacOS is not supported officially, but should not be too hard to adapt based on the Linux support.\n\nIt also supports any `googletest` conformant source/test files (googletest will be automatically fetched/installed if cmake and git are available).\n\nFinally, it also fully supports `Python`, using `pytest` under the hood as a backend,\noffering the same fast TDD experience.\n\n### Quick start for the impatient\n1. Clone UT at the root of your existing project:\n\n`$ git clone https://github.com/nsauzede/.ut`\n\nThat's it! Everything is setup, tests can be written and run.\n\n2. Add tests:\n\nInclude `ut/ut.h` inside any C or C++ source/test file (must be named '*test.{c,cpp}' for automatic detection by `ut` tool) and add testcases like this:\n```C\n// Some \"foo_test.c\" source/test file\nint foo() { return 42; }\n#include \u003cut/ut.h\u003e\nTESTCASE(Test_foo_behaviour)\n    TESTMETHOD(test_foo_returns_the_answer) {\n        ASSERT_EQ(42, foo());\n    }\n```\n```C++\n// Some \"foo_test.cpp\" source/test file\nclass Foo { public: int foo() { return 42; } } foo;\n#include \u003cut/ut.h\u003e\nTESTCASE(Test_foo_behaviour)\n    TESTMETHOD(test_foo_returns_the_answer) {\n        ASSERT_EQ(42, foo.foo());\n    }\n```\n3. Run tests:\n```\n$ .ut/ut --fast -v retest\n============================== test session starts ===============================\nplatform win32 -- ut 0.0.10, language C, GCC 14.2.0 -- C:\\msys64\\tmp\\.ut\\.cache\\test.c.fast.exe\ncachedir: .ut/.cache\nrootdir: C:\\msys64\\tmp\ncollected 1 items\n\ntest.c::test_foo_returns_the_answer PASSED                                 [100%]\n\n=============================== 1 passed in 0.00s ================================\n============================== test session starts ===============================\nplatform win32 -- ut 0.0.10, language C++, GCC 14.2.0 -- C:\\msys64\\tmp\\.ut\\.cache\\foo_test.cpp.fast.exe\ncachedir: .ut/.cache\nrootdir: C:\\msys64\\tmp\ncollected 1 items\n\nfoo_test.cpp::test_foo_returns_the_answer PASSED                           [100%]\n\n=============================== 1 passed in 0.00s ================================\n```\n4. ...\n5. _Profit!_\n\nIf TCC, GCC, CLANG, VALGRIND (linux only), are available, they will all be used automatically:\n- fast tests try to use `tcc` (or `gcc`, or `clang`) and `g++` (or `clang++`)\n- slow tests try to use `clang` (or `gcc`, or `tcc`) and `clang++` (or `g++`) and `valgrind`\n\nThe `test` command above automatically builds and tests all/only the last modified source/test files.\nThe `--fast` and `-v` options are optional, and select only fast tests, with increased verbosity.\nConsult `.ut/ut --help` for more information.\n\nTo systematically rebuild/retest everything unconditionally, use `retest`.\n\nTo enter a typical TDD Red-Green-Refactor loop, use `watch`:\n```\n$ .ut/ut watch\n```\n=\u003e From now on, each you modify a source/test file (eg: within VSCode), all related tests will get automatically rebuilt/retested.\n\n\nNote that the tests can be put in separate files than the implementation.\nIn that case, all that is needed, is to include the source file at the top of the test file, like so:\n```C\n// Some \"foo_test.c\" (or eg: \"foo_test.cpp\") test file\n#include \"path/to/foo.c\"          // or #include \"path/to/foo.cpp\"\n\n#include \u003cut/ut.h\u003e\nTESTCASE(Test_foo_behaviour)\n    TESTMETHOD(test_foo_returns_the_answer) {\n        ASSERT_EQ(42, foo());\n    }\n...\n```\n\n\n`TESTCASE` registers a kind of TestCase 'class', like with Python `unittest`/`pytest`\nand `TESTMETHOD` registers a test method inside such a TestCase 'class'.\nInside such a test method, regular C/C++ code can be written, using `ASSERT*` provided macros\nto perform test assertions.\n\nNote that, for simple tests cases, the `TESTCASE` construct can be ommitted, thus only `TESTMETHOD` have to be used, for less boilerplate code.\nThis can be useful eg: for quickly prototyping an idea with the following minimalistic source/test file:\n```C\n// Some \"foo_test.c\" (or \"foo_test.cpp\") source source/test file\nint foo { return 42; }\n...\n#include \u003cut/ut.h\u003e\nTESTMETHOD(test_foo_returns_the_answer) {\n    ASSERT_EQ(42, foo());\n}\n...\n```\nThe only caveat, in that case, is that all such defined `TESTMETHOD` symbols (`test_foo_returns_the_answer` in that case) must be unique, whereas they could be duplicates when registered in different `TESTCASE` like previously.\n\n\nNote that in fact any C/C++ file (even not named `*test.{c,cpp}`) can also be manually built/run as an unit-test executable like so:\n```\n$ gcc a.c -o a -I.ut/include \u0026\u0026 ./a\na.c .                                                            1 passed in 0.00s\n```\nThe executable returns 0 if all test cases/methods pass.\n\n### Detailed information (aka old documentation)\nSome optional tools/scripts are provided by UT, to accelerate the TDD-loop approach: red-green-refactor steps.\n\n1) a `Makefile` is provided to automatically clean/build/test all C/C++ adequate test files\n2) a `watch.sh` shell script constinuously monitors file-system changes and re-run modified tests\n3) an `ut` shell script abstracts these `clean`, `test`, `watch`, ... commands. See `ut --help`\n4) `ut` supports Bash auto-completion: add `ut` script location to PATH then register it in `.bashrc`:\n```shell\nut=`command -v ut` \u0026\u0026 [ -x $ut ] \u0026\u0026 . $ut\n```\n\nOnce you cloned the UT git directory somewhere, and added its location in your PATH, you don't even need to clone it again\nin all your projects, you just have to use the `ut init` command (akin to eg: `git init`) to initialize them.\nIt will only create a mostly empty `.ut` directory at the root of your project, which will contain eg: test cache datas.\n\nHow (easy it is) to use `ut` tool?\nFirst you have to initialize the ut project root directory (only once!).\nThis is where the cache will be stored, and it defines the subtree that will be searched for tests to run.\n```shell\n$ cd \u003cto your future ut project root\u003e\n$ ut init\n```\nThen, you can run the tests, from anywhere below or at your ut project root:\n```shell\n$ cd \u003canywhere below or at ut project root\u003e\n$ ut test\n\u003c Python and/or C/C++ tests output\u003e\n...\n$\n```\nIf all tests passed, then an immediate `test` rerun (ie: without changing the sources) should not output anything:\n```shell\n$ cd \u003canywhere below or at ut project root\u003e\n$ ut test\n$\n```\nThat's expected, because all tests passed, and source files/tests have not changed.\nIf needed, it is possible to force the tests to re-run, either by cleaning the cache:\n```shell\n$ cd \u003canywhere below or at ut project root\u003e\n$ ut clean\n$ ut test\n\u003c Python and/or C/C++ tests output\u003e\n...\n$\n```\nOr by using the `retest` command that just does `clean`+`test`:\n```shell\n$ cd \u003canywhere below or at ut project root\u003e\n$ ut retest\n\u003c Python and/or C/C++ tests output\u003e\n...\n$\n```\n\nNote that a handy feature allows to only run tests below a certain subdirectory (to not run any tests outside of it).\nEg: if there are two test subdirs `tests1/` and `tests1/` below the ut project root, then the following will only re-run tests from `test1/`:\n```shell\n$ cd \u003cto ut project root\u003e\n$ ut retest tests1\n\u003c Python and/or C/C++ tests output from tests1 only \u003e\n...\n$\n```\n\n\n# Dependencies\nIt is required to install the following dependencies:\n- `make` (4.3+), `gcc` (13.2+)\n- `python` (3.9+)\n- `inotify-tools` (linux only)\n\nIt is also recommended to install those too:\n- `git`, `cmake`, `pytest`\n- `tcc`, `clang`\n- `valgrind` (linux only)\n\n[WorkflowBadgeLinux]: https://github.com/nsauzede/.ut/workflows/Linux/badge.svg\n[WorkflowBadgeWindows]: https://github.com/nsauzede/.ut/workflows/Windows/badge.svg\n[WorkflowUrl]: https://github.com/nsauzede/.ut/commits/main\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsauzede%2F.ut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnsauzede%2F.ut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsauzede%2F.ut/lists"}