{"id":19517578,"url":"https://github.com/jasmcaus/tau","last_synced_at":"2025-04-04T22:06:39.416Z","repository":{"id":38356576,"uuid":"341468137","full_name":"jasmcaus/tau","owner":"jasmcaus","description":"A Micro (1k lines of code) Unit Test Framework for C/C++","archived":false,"fork":false,"pushed_at":"2024-11-12T16:27:14.000Z","size":3870,"stargazers_count":167,"open_issues_count":14,"forks_count":31,"subscribers_count":9,"default_branch":"dev","last_synced_at":"2025-03-28T21:06:29.191Z","etag":null,"topics":["1k-lines","assertion-macros","assertions","binary-comparisons","c","c-plus-plus","c11","c17","cmake","cpp","cpp11","cpp17","cpp20","embedded","macros","tau","test-framework","testing","testing-framework","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/jasmcaus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":"jasmcaus","open_collective":null,"ko_fi":"jasmcaus","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"http://paypal.me/jasmcaus"}},"created_at":"2021-02-23T07:35:42.000Z","updated_at":"2025-03-11T00:10:56.000Z","dependencies_parsed_at":"2024-03-12T12:57:41.762Z","dependency_job_id":"5cba8096-1dd5-4198-bb0e-ec9662f37329","html_url":"https://github.com/jasmcaus/tau","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasmcaus%2Ftau","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasmcaus%2Ftau/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasmcaus%2Ftau/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasmcaus%2Ftau/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasmcaus","download_url":"https://codeload.github.com/jasmcaus/tau/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256112,"owners_count":20909240,"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":["1k-lines","assertion-macros","assertions","binary-comparisons","c","c-plus-plus","c11","c17","cmake","cpp","cpp11","cpp17","cpp20","embedded","macros","tau","test-framework","testing","testing-framework","unit-testing"],"created_at":"2024-11-11T00:04:58.601Z","updated_at":"2025-04-04T22:06:39.398Z","avatar_url":"https://github.com/jasmcaus.png","language":"C","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ch1\u003eTau τ\u003c/h1\u003e\n\n[![Standard](https://img.shields.io/badge/C-11/14/17-blue.svg)](https://en.wikipedia.org/wiki/C_(programming_language))\n[![Standard](https://img.shields.io/badge/C%2B%2B-11/14/17/20-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B)\n[![License](https://img.shields.io/github/license/jasmcaus/tau?label=license)][license]\n[![Twitter](https://img.shields.io/twitter/follow/jasmcaus.svg?style=flatl\u0026label=Follow\u0026logo=twitter\u0026logoColor=white\u0026color=1da1f2)][twitter-badge]\n[![Download](https://img.shields.io/badge/download%20%20-link-green.svg)](https://github.com/jasmcaus/tau/releases)\n[![Docs](https://img.shields.io/badge/docs%20%20-online-blue.svg)][docs]\n\n\u003c/div\u003e\n\nA Micro Unit Testing Framework for \u003eC11/C++11 projects, with the promise of *always being tiny* - about 1k lines of\ncode. This framework is a *much* simpler, *much* lighter and *much* faster alternative to heavier frameworks like\nGoogle Test, \u0026 Catch2, making it suitable for on-to-go testing (embedded developers will especially love us!).\n\nI initially wrote Tau to be a unit testing framework for C; however, initial results showed great promise of\ncompiling with (and testing) C++ code. While Tau doesn't currently support mocking, or a way to test for exceptions\nin C++, its limitations are in fact its biggest strength - you get *negligible* overhead \u0026 fast compilation speeds\nfor the sacrifice of a few constructs.\n\n\n## Features\n* *Ultra-light* (~1k lines of code)\n* **8x** times faster than GoogleTest and Catch2\n* Can test both C and C++ code (see [ThirdParty tests](https://github.com/jasmcaus/tau/blob/dev/test/ThirdParty))\n* [Blazing Fast Assertions](https://github.com/jasmcaus/tau/blob/dev/benchmarks)\n* Gtest-like Assertion Macros\n* Supports Test Fixtures\n* Allows filtering of test cases\n\n\n# Installation\nNone! Tau is header-only, so simply include it in your project.\n```c\n#include \u003ctau/tau.h\u003e\n```\n\nTo build Tau with CMake, read through the [CMake Quickstart Guide](https://github.com/jasmcaus/tau/blob/dev/docs/cmake-quickstart.md).\n\nAlternatively, use `-I tau` to add the repository directory to the compiler search paths.\n\n\u003c!-- ## Basic Concepts\nTau provides several variants of Assertion Macros for us - `CHECK`s which are *non-fatal* asserts, and `REQUIRE`s\nwhich are *fatal* asserts. The result of an assertion is either *success*, *non-fatal failure* or a *fatal failure*.\nUnless the latter takes place, the program continues normally.\n\nIn Tau, you would normally define a ***Test Suite*** which contains multiple tests. These test suites should\nideally reflect the structure of your tested code.  --\u003e\n\n\n# Prerequistes\nTo begin, you **must** include the following in *any* (but only one) C/C++ file. This initializes Tau to set up\nall your tests:\n```c\nTAU_MAIN() // IMPORTANT: No semicolon at the end\n```\nThis defines a main function, so if you write a `main()` function ***and*** declare `TAU_MAIN()`, your compiler will\nthrow a `redeclaration of main` error.\n\nIf you must write a `main()` function, use the following instead:\n```c\nTAU_NO_MAIN()\n```\nThis won't define a main function, but sets up any variables/methods that Tau needs to run properly.\n\n\n# Getting Started\n## Defining a Test Suite\nTo define a test suite, simply do the following:\n```c\nTEST(TestSuiteName, TestName) {\n    CHECK(1); // does not fail\n    ... rest of the test body ...\n}\n```\nThe `TEST` macro takes two parameters - the first is the name of the Test Suite, and the second is the name of the\ntest. This allows tests to be grouped for convenience.\n\n\n## Testing Macros\nTau provides two variants of Assertion Macros - `CHECK`s and `ASSERT`s. These resemble function calls. When these\nassertions fail, Tau prints the source code location (file + line number) along with a failure message.\n\n`ASSERT`s generate *fatal* failures - the test suite will cease its execution and move on to the next test suite to\nrun.\n\n`CHECK`s generate *non-fatal* failures - the remainder of the test suite will still execute, allowing for further\nchecks to run.\n\nRead [the Primer](https://github.com/jasmcaus/tau/blob/dev/docs/tau-primer.md) for more details, including the\nother testing macros Tau provides you with.\n\n\n## Example Usage\nBelow is a slightly contrived example showing a number of possible supported operations:\n```C\n#include \u003ctau/tau.h\u003e\nTAU_MAIN() // sets up Tau (+ main function)\n\nTEST(foo, bar1) {\n    int a = 42;\n    int b = 13;\n    CHECK_GE(a, b); // pass :)\n    CHECK_LE(b, 8); // fail - Test suite not aborted\n}\n\nTEST(foo, bar2) {\n    char* a = \"foo\";\n    char* b = \"foobar\";\n    REQUIRE_STREQ(a, a); // pass :)\n    REQUIRE_STREQ(a, b); // fail - Test suite aborted\n}\n```\n\n\n# Supported Platforms\nTau supports codebases and compilers that are compliant with the C11/C++11 standard or newer. Tau's source\ncode is officially supported on the following platforms. If you notice any problems on your platform, please\nfile an issue on the [Tau Github Issue Tracker][issues]. PRs with fixes are welcome!\n\nOperating Systems          | Compilers\n-------------------------- | --------------------------\nLinux                      | gcc 5.0+\nmacOS                      | clang 5.0+\nWindows                    | MSVC 2017+\n\n\n# Contributing\nWe appreciate all contributions, feedback and issues. If you plan to contribute new features, utility functions,\nor extensions to the core, please go through our [Contribution Guidelines][contributing].\n\nTo contribute, start working through the `Tau` codebase, read the [Documentation][docs], navigate to the\n[Issues][issues] tab and start looking through interesting issues.\n\n\n# Asking for help\nIf you have any questions, please:\n1. [Read the docs][docs].\n2. [Look it up in our Github Discussions (or add a new question)][discussions].\n2. [Search through the issues][issues].\n\n\n# Who uses Tau?\nIn addition to several of my personal projects, Tau is also used in the following notable projects:\n* The [Adorad Programming Language](https://github.com/adorad/adorad)\n\n\n# Supporting This Project\nIf you are able to and would like to sponsor this project, you may do so using either of the links below. Thank you very much in advance :)\n\n\u003cp align=\"center\"\u003e\n\u003c!--    \u003ca href=\"https://www.buymeacoffee.com/jasmcaus\" target = \"_blank\"\u003e\u003cimg alt=\"Buy Jason a Coffee\" width=\"48px\" src=\"https://raw.githubusercontent.com/adi1090x/files/master/other/1.png\"\u003e\u003c/a\u003e --\u003e\n    \u003ca href=\"https://www.ko-fi.com/jasmcaus\" target=\"_blank\"\u003e\u003cimg alt=\"Buy Jason a Coffee\" width=\"48px\" src=\"https://raw.githubusercontent.com/adi1090x/files/master/other/2.png\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.paypal.me/jasmcaus\" target=\"_blank\"\u003e\u003cimg alt=\"Buy Jason a Coffee\" width=\"48px\" src=\"https://raw.githubusercontent.com/adi1090x/files/master/other/3.png\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.patreon.com/jasmcaus\" target=\"_blank\"\u003e\u003cimg alt=\"Buy Jason a Coffee\" width=48px src=\"https://raw.githubusercontent.com/adi1090x/files/master/other/4.png\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n# License\nThis project was written by [Jason Dsouza](https://github.com/jasmcaus) and licensed under the [MIT License](LICENSE).\n\n[contributing]: https://github.com/jasmcaus/tau/blob/dev/.github/CONTRIBUTING.md\n[docs]: https://github.com/jasmcaus/tau/blob/dev/docs\n[discussions]: https://github.com/jasmcaus/tau/discussions\n[issues]: https://github.com/jasmcaus/tau/issues\n\n[twitter-badge]: https://twitter.com/jasmcaus\n[license]: https://github.com/jasmcaus/tau/blob/dev/LICENSE\n","funding_links":["https://patreon.com/jasmcaus","https://ko-fi.com/jasmcaus","http://paypal.me/jasmcaus","https://www.buymeacoffee.com/jasmcaus","https://www.ko-fi.com/jasmcaus","https://www.paypal.me/jasmcaus","https://www.patreon.com/jasmcaus"],"categories":["Testing","测试"],"sub_categories":["YAML"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasmcaus%2Ftau","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasmcaus%2Ftau","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasmcaus%2Ftau/lists"}