tunit - Reference Guide  1.0.0
Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android.
tunit - Reference Guide Documentation

Features

  • An xUnit test framework.
  • Auto registration of class and method based tests.
  • Rich set of assertions.
  • ...

For more information see tunit website (or markdown documentations) and Reference Guide).

Examples

The classic first application 'Hello World'.

src/tunit_hello_world.cpp:

#include <tunit/tunit>
#include <string>
using namespace std;
using namespace tunit;
namespace unit_tests {
class test_class_(hello_world_test) {
public:
void test_method_(create_string_from_literal) {
string s = "Hello, World!";
valid::are_equal(13, s.size());
assert::are_equal_("Hello, World!", s);
}
void test_method_(create_string_from_chars) {
string s = {'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
valid::are_equal(13, s.size());
string_assert::starts_with("Hello,", s);
string_assert::ends_with(" World!", s);
}
};
}
// The main entry point for the application.
int main() {
return console_unit_test().run();
}

For more examples see examples.

Download and install

Before running examples you must download and install tunit. To download and install it read Downloads.md file.