Getting started with Catch
Catch is a multiparadigm header-only testing framework for C++ and Objective-C. The name Catch stands for C++ Automated Test Cases in Headers. It enables developers to write tests using either the traditional style of test functions grouped in test cases or the Behavior Driven Development (BDD) style with given-when-then sections. Tests are self-registered and the framework provides several assertion macros; out of these, two are most used: one fatal, namely REQUIRE
, and one non-fatal, namely CHECK
. They perform expression decomposition of both left- and right-hand side values which are logged in case of failure.
Getting ready
The Catch test framework has a macro-based API. Although you only need to use the supplied macros for writing tests, a good understanding of macros is recommended if you want to use the framework well.
How to do it...
In order to set up your environment to use the Catch testing framework, do the following:
- Clone or download the Git repository...