Unit Test and Benchmark for Modern C++ with Catch2
The ease of use and the fact that it doesn't need external dependencies sets it apart from the rest!
What is Catch2?
Catch2 is a Unit Testing framework for C++, but it also provides basic micro-benchmarking capabilities and simple BDD macros.
The main advantage of Catch2 is that its use is simple and natural. Test names don’t need to be valid identifiers, assertions look like normal C++ Boolean expressions, and sections provide a nice, local way to share setup and teardown code across tests.
It’s another option to Google Test, Boost.Test, CppUnit, Cute and others.
Installation
To compile and install it on your system, run the commands below:
Example of use
Create an example file: vim example.cpp:
To compile via command line:
Possible output after running the binary:
Options
In the binary you included the test, you can use a list of parameters.