An open API service indexing awesome lists of open source software.

https://github.com/mrtkp9993/unittestcpp

Simple header-only C++ library for unit-testing.
https://github.com/mrtkp9993/unittestcpp

cpp cpp-library cpp11 header-only testing testing-tools

Last synced: 11 months ago
JSON representation

Simple header-only C++ library for unit-testing.

Awesome Lists containing this project

README

          

# Unit Test C++

Header-only simple unit-testing library for C++.

[![DOI](https://zenodo.org/badge/304688740.svg)](https://zenodo.org/badge/latestdoi/304688740)

## Usage

Just include ```test.hpp``` in your app and use it like in ```main.cpp```:

```c++
#include

#include "test.hpp"

int main() {
std::vector> test_funcs = {
[]() { return 1 == 1; }, // TEST 1
[]() { return !(1 == 2); }, // TEST 2
[]() { return 1 == 2; } // TEST 3
};

Test tests(test_funcs);
tests.Run();

return 0;
}
```

Example result:

```
Test 3 FAILED
Run completed, # of failed tests/total tests: 1/3
```