All Projects → jasmcaus → tau

jasmcaus / tau

Licence: MIT license
A Micro (1k lines of code) Unit Test Framework for C/C++

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tau

Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (-83.47%)
Mutual labels:  unit-testing, test-framework, testing-framework
Doctest
The fastest feature-rich C++11/14/17/20 single-header testing framework
Stars: ✭ 3,568 (+2848.76%)
Mutual labels:  unit-testing, testing-framework, cpp20
Dredd
Language-agnostic HTTP API Testing Tool
Stars: ✭ 3,770 (+3015.7%)
Mutual labels:  unit-testing, test-framework, testing-framework
testza
Full-featured test framework for Go! Assertions, fuzzing, input testing, output capturing, and much more! 🍕
Stars: ✭ 409 (+238.02%)
Mutual labels:  unit-testing, test-framework, testing-framework
Zunit
A powerful testing framework for ZSH projects
Stars: ✭ 140 (+15.7%)
Mutual labels:  unit-testing, assertions, test-framework
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (-66.12%)
Mutual labels:  unit-testing, test-framework, testing-framework
Bash unit
bash unit testing enterprise edition framework for professionals
Stars: ✭ 419 (+246.28%)
Mutual labels:  unit-testing, assertions, test-framework
doctest
The fastest feature-rich C++11/14/17/20 single-header testing framework
Stars: ✭ 4,434 (+3564.46%)
Mutual labels:  unit-testing, testing-framework, cpp20
cpptest
🛠️ Powerful, yet simple, C++ unit testing framework; new home after https://sourceforge.net/projects/cpptest/
Stars: ✭ 51 (-57.85%)
Mutual labels:  unit-testing, test-framework, testing-framework
Ava
Node.js test runner that lets you develop with confidence 🚀
Stars: ✭ 19,458 (+15980.99%)
Mutual labels:  unit-testing, test-framework
Bach
Bach Testing Framework
Stars: ✭ 392 (+223.97%)
Mutual labels:  unit-testing, testing-framework
Ut
UT: C++20 μ(micro)/Unit Testing Framework
Stars: ✭ 507 (+319.01%)
Mutual labels:  unit-testing, testing-framework
Luaunit
LuaUnit is a popular unit-testing framework for Lua, with an interface typical of xUnit libraries (Python unittest, Junit, NUnit, ...). It supports several output formats (Text, TAP, JUnit, ...) to be used directly or work with Continuous Integration platforms (Jenkins, Maven, ...).
Stars: ✭ 362 (+199.17%)
Mutual labels:  unit-testing, assertions
Data Mocks
Library to mock local data requests using Fetch or XHR
Stars: ✭ 55 (-54.55%)
Mutual labels:  unit-testing, test-framework
Deepstate
A unit test-like interface for fuzzing and symbolic execution
Stars: ✭ 603 (+398.35%)
Mutual labels:  unit-testing, testing-framework
Qtools
QTools collection of open source tools for embedded systems development on Windows, Linux and MacOS
Stars: ✭ 64 (-47.11%)
Mutual labels:  unit-testing, test-framework
Sazerac
Data-driven unit testing for Jasmine, Mocha, and Jest
Stars: ✭ 322 (+166.12%)
Mutual labels:  unit-testing, assertions
Pgtap
PostgreSQL Unit Testing Suite
Stars: ✭ 631 (+421.49%)
Mutual labels:  unit-testing, testing-framework
Atoum
The modern, simple and intuitive PHP unit testing framework.
Stars: ✭ 1,382 (+1042.15%)
Mutual labels:  unit-testing, test-framework
Automation Arsenal
Curated list of popular Java and Kotlin frameworks, libraries and tools related to software testing, quality assurance and adjacent processes automation.
Stars: ✭ 105 (-13.22%)
Mutual labels:  unit-testing, testing-framework

Tau τ

Standard Standard License Twitter Download Docs

A Micro Unit Testing Framework for >C11/C++11 projects, with the promise of always being tiny - about 1k lines of code. This framework is a much simpler, much lighter and much faster alternative to heavier frameworks like Google Test, & Catch2, making it suitable for on-to-go testing (embedded developers will especially love us!).

I initially wrote Tau to be a unit testing framework for C; however, initial results showed great promise of compiling with (and testing) C++ code. While Tau doesn't currently support mocking, or a way to test for exceptions in C++, its limitations are in fact its biggest strength - you get negligible overhead & fast compilation speeds for the sacrifice of a few constructs.

Features

  • Ultra-light (~1k lines of code)
  • 8x times faster than GoogleTest and Catch2
  • Can test both C and C++ code (see ThirdParty tests)
  • Blazing Fast Assertions
  • Gtest-like Assertion Macros
  • Supports Test Fixtures
  • Allows filtering of test cases

Installation

None! Tau is header-only, so simply include it in your project.

#include <tau/tau.h>

To build Tau with CMake, read through the CMake Quickstart Guide.

Alternatively, use -I tau to add the repository directory to the compiler search paths.

Prerequistes

To begin, you must include the following in any (but only one) C/C++ file. This initializes Tau to set up all your tests:

TAU_MAIN() // IMPORTANT: No semicolon at the end

This defines a main function, so if you write a main() function and declare TAU_MAIN(), your compiler will throw a redeclaration of main error.

If you must write a main() function, use the following instead:

TAU_NO_MAIN()

This won't define a main function, but sets up any variables/methods that Tau needs to run properly.

Getting Started

Defining a Test Suite

To define a test suite, simply do the following:

TEST(TestSuiteName, TestName) {
    CHECK(1); // does not fail
    ... rest of the test body ...
}

The TEST macro takes two parameters - the first is the name of the Test Suite, and the second is the name of the test. This allows tests to be grouped for convenience.

Testing Macros

Tau provides two variants of Assertion Macros - CHECKs and ASSERTs. These resemble function calls. When these assertions fail, Tau prints the source code location (file + line number) along with a failure message.

ASSERTs generate fatal failures - the test suite will cease its execution and move on to the next test suite to run.

CHECKs generate non-fatal failures - the remainder of the test suite will still execute, allowing for further checks to run.

Read the Primer for more details, including the other testing macros Tau provides you with.

Example Usage

Below is a slightly contrived example showing a number of possible supported operations:

#include <tau/tau.h>
TAU_MAIN() // sets up Tau (+ main function)

TEST(foo, bar1) {
    int a = 42;
    int b = 13;
    CHECK_GE(a, b); // pass :)
    CHECK_LE(b, 8); // fail - Test suite not aborted
}

TEST(foo, bar2) {
    char* a = "foo";
    char* b = "foobar";
    REQUIRE_STREQ(a, a); // pass :)
    REQUIRE_STREQ(a, b); // fail - Test suite aborted
}

Supported Platforms

Tau supports codebases and compilers that are compliant with the C11/C++11 standard or newer. Tau's source code is officially supported on the following platforms. If you notice any problems on your platform, please file an issue on the Tau Github Issue Tracker. PRs with fixes are welcome!

Operating Systems Compilers
Linux gcc 5.0+
macOS clang 5.0+
Windows MSVC 2017+

Contributing

We appreciate all contributions, feedback and issues. If you plan to contribute new features, utility functions, or extensions to the core, please go through our Contribution Guidelines.

To contribute, start working through the Tau codebase, read the Documentation, navigate to the Issues tab and start looking through interesting issues.

Asking for help

If you have any questions, please:

  1. Read the docs.
  2. Look it up in our Github Discussions (or add a new question).
  3. Search through the issues.

Who uses Tau?

In addition to several of my personal projects, Tau is also used in the following notable projects:

Supporting This Project

If 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 :)

Buy Jason a Coffee Buy Jason a Coffee Buy Jason a Coffee

License

This project was written by Jason Dsouza and licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].