{"id":13746022,"url":"https://github.com/tymonx/utest","last_synced_at":"2025-08-21T23:03:16.108Z","repository":{"id":83534122,"uuid":"75431636","full_name":"tymonx/utest","owner":"tymonx","description":"Lightweight unit testing framework for C/C++ projects. Suitable for embedded devices.","archived":false,"fork":false,"pushed_at":"2017-02-21T20:23:49.000Z","size":335,"stargazers_count":19,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-22T16:33:34.318Z","etag":null,"topics":["arm","arm-microcontrollers","bsd-license","c-plus-plus","c-plus-plus-11","cmake","cortex-m","cpp","cpp11","embedded","embedded-devices","microcontrollers","tdd","test-driven-development","testing","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tymonx.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}},"created_at":"2016-12-02T21:17:50.000Z","updated_at":"2023-11-25T16:02:20.000Z","dependencies_parsed_at":"2024-01-13T01:38:41.207Z","dependency_job_id":"633f74a6-a235-4e86-9680-713d80a70cf0","html_url":"https://github.com/tymonx/utest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Futest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Futest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Futest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Futest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tymonx","download_url":"https://codeload.github.com/tymonx/utest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248888778,"owners_count":21178103,"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":["arm","arm-microcontrollers","bsd-license","c-plus-plus","c-plus-plus-11","cmake","cortex-m","cpp","cpp11","embedded","embedded-devices","microcontrollers","tdd","test-driven-development","testing","unit-testing"],"created_at":"2024-08-03T06:00:43.154Z","updated_at":"2025-04-14T13:33:02.657Z","avatar_url":"https://github.com/tymonx.png","language":"C++","funding_links":[],"categories":["Testing Frameworks"],"sub_categories":[],"readme":"# µTest\n\n[![Language](https://img.shields.io/badge/language-C++-blue.svg?style=flat)](https://isocpp.org/)\n[![Standard](https://img.shields.io/badge/c%2B%2B-11/14/17-blue.svg?style=flat)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)\n[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat)](http://opensource.org/licenses/BSD-3-Clause)\n[![Build Status](https://travis-ci.org/tymonx/utest.svg?branch=master)](https://travis-ci.org/tymonx/utest)\n[![Coverity Scan Build Status](https://scan.coverity.com/projects/11797/badge.svg)](https://scan.coverity.com/projects/tymonx-utest)\n[![Coverage Status](https://coveralls.io/repos/github/tymonx/utest/badge.svg?branch=master)](https://coveralls.io/github/tymonx/utest?branch=master)\n[![Join the chat at https://gitter.im/utest-embedded/Lobby](https://badges.gitter.im/utest-embedded/Lobby.svg)](https://gitter.im/utest-embedded/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nLightweight unit testing framework mainly for C++ and also for C projects. Suitable for embedded devices.\n\n## Key Features\n\n* Written in C++11\n* An XUnit test framework\n* The 3-clause BSD license\n* No evil defined test macros, programmer API style\n* Detailed assert messages including type info, address and total size in bytes\n* Automatic test registration\n* Single registered test can have multi test suites and test cases\n* A rich set of assertions\n* Fatal and non-fatal assertions\n* Support for multi reporters with multi writers\n* Working with/without exceptions and RTTI\n* Optionally running test case in isolate environment using thread\n* Minimal virtual methods usage\n* Small footprint, friendly for embedded target like Cortex-Mx microcontrollers\n* Warnings free even on the most aggressive levels\n* Support for Clang 3.5 and later\n* Support for GCC 4.8 and later\n\n## How to use it\n\n* [Build under Linux](docs/build-linux.md)\n* [Build for ARM target](docs/build-arm.md)\n\n## Examples\n\nTest source example:\n\n```c++\n#include \u003cutest/utest.hpp\u003e\n\nusing namespace utest;\n\nstatic unsigned int Factorial(unsigned int number) {\n    return number \u003e 1 ? Factorial(number - 1) * number : 1;\n}\n\nstatic TestRunner g([] (TestSuite\u0026 test_suite) {\n    test_suite.name(\"Factorial\").run([] (TestCase\u0026 test_case) {\n        test_case.name(\"computed\").run([] (TestParams\u0026 p) {\n            TestAssert{p}.equal(Factorial(0), 1u);\n            TestAssert{p}.equal(Factorial(1), 1u);\n            TestAssert{p}.equal(Factorial(2), 2u);\n            TestAssert{p}.equal(Factorial(3), 6u);\n            TestAssert{p}.equal(Factorial(10), 3628800u);\n        });\n    });\n});\n ```\n\nTest output example:\n\n```\n[==========] Running 1 registered test runner(s).\n[----------] Running test(s) from Factorial\n[ RUN      ] computed\n[       OK ] computed\n[----------] 1 test(s) from Factorial\n[  PASSED  ] 1 test(s).\n\n[==========] 1 test(s) from 1 test suite(s) ran.\n[  PASSED  ] 1 test(s).\n```\n\nTest assert message examples:\n```\nunit_test.cpp:7: Failure\nExpected: (boolean)[address=0x00007fa3b3411e08,size=1] is true\n  Actual: false\n\nunit_test.cpp:13: Failure\nExpected: (string)[address=0x00007fff4d0c00b0,size=4] == (string)[address=0x00000000004097ee,size=5]\n  Actual: \"Text\" == \"TextB\"\n\nunit_test.cpp:17: Failure\nExpected: (signed int)[address=0x00007fa3b3411dc8,size=4] == (signed int)[address=0x00007fa3b3411d98,size=4]\n  Actual: 1 == 2\n```\n\nMain example with multi writers:\n\n```c++\n#include \u003cutest/utest.hpp\u003e\n\n#include \u003cutest/test_writer/udp.hpp\u003e\n#include \u003cutest/test_writer/file.hpp\u003e\n#include \u003cutest/test_reporter/google_test.hpp\u003e\n\n#include \u003ccstdlib\u003e\n\nusing namespace utest;\n\nint main(int argc, char* argv[]) {\n    test_writer::UDP udp{\"127.0.0.1\", 51234};\n    test_writer::File out{stdout};\n\n    TestWriterRefence writers[]{\n        out,\n        udp\n    };\n\n    test_reporter::GoogleTest google_test{writers};\n\n    TestReporterReference reporters[]{\n        google_test\n    };\n\n    return TestStatus::PASS == Test{argc, argv}.run().status()\n        ? EXIT_SUCCESS : EXIT_FAILURE;\n}\n```\n\nTest example with evil macros extension:\n\n```\n#include \u003cutest/utest.hpp\u003e\n#include \u003cutest/test_extension/evil_defines.hpp\u003e\n\nUTEST_RUNNER()\n    UTEST_SUITE(\"integer compare\")\n        int x = 0;\n\n        UTEST_CASE_CONTEXT(x);\n\n        UTEST_CASE_SETUP()\n            UTEST_CONTEXT(int) = 5;\n        UTEST_CASE_SETUP_END\n\n        UTEST_CASE(\"equal\")\n            UTEST_EXPECT_EQ(UTEST_CONTEXT(int), 5);\n        UTEST_CASE_END\n\n        UTEST_CASE_SETUP()\n            UTEST_CONTEXT(int) = 4;\n        UTEST_CASE_SETUP_END\n\n        UTEST_CASE(\"not equal\")\n            UTEST_EXPECT_NE(UTEST_CONTEXT(int), 5);\n        UTEST_CASE_END\n    UTEST_SUITE_END\nUTEST_RUNNER_END\n ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftymonx%2Futest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftymonx%2Futest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftymonx%2Futest/lists"}