The Catch framework enables you to write tests using either the traditional style of test cases and test functions or the BDD style with scenarios and given-when-then sections. Tests are defined as separate sections of a test case and can be nested as deep as you want. Whichever style you prefer, tests are defined with only two base macros. This recipe will show what these macros are and how they work.
Writing and invoking tests with Catch
How to do it...
To write tests using the traditional style, with test cases and test functions, do this:
- Use the TEST_CASE macro to define a test case with a name (as a string), and optionally, a list of its associated tags:
TEST_CASE("test construction", "[create]")
{
// define...