mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 11:23:29 +01:00
Add page titles
This commit is contained in:
parent
dee61df274
commit
071f49b12b
@ -1,4 +1,6 @@
|
||||
<a id="top"></a>
|
||||
# Reference
|
||||
|
||||
To get the most out of Catch, start with the [tutorial](tutorial.md#top).
|
||||
Once you're up and running consider the following reference material.
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
<a id="top"></a>
|
||||
# Command line
|
||||
|
||||
Catch works quite nicely without any command line options at all - but for those times when you want greater control the following options are available.
|
||||
Click one of the followings links to take you straight to that option - or scroll on to browse the available options.
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
<a id="top"></a>
|
||||
# Compile-time configuration
|
||||
|
||||
Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```).
|
||||
|
||||
Nonetheless there are still some occasions where finer control is needed. For these occasions Catch exposes a set of macros for configuring how it is built.
|
||||
|
@ -1,4 +1,6 @@
|
||||
<a id="top"></a>
|
||||
# Test fixtures
|
||||
|
||||
Although Catch allows you to group tests together as sections within a test case, it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too. You define the test fixture as a simple structure:
|
||||
|
||||
```c++
|
||||
|
@ -1,5 +1,7 @@
|
||||
<a id="top"></a>
|
||||
# Getting Catch
|
||||
# Tutorial
|
||||
|
||||
## Getting Catch
|
||||
|
||||
The simplest way to get Catch is to download the latest [single header version](https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp). The single header is generated by merging a set of individual headers but it is still just normal source code in a header file.
|
||||
|
||||
@ -12,7 +14,7 @@ Catch is header only. All you need to do is drop the file(s) somewhere reachable
|
||||
|
||||
The rest of this tutorial will assume that the Catch single-include header (or the include folder) is available unqualified - but you may need to prefix it with a folder name if necessary.
|
||||
|
||||
# Writing tests
|
||||
## Writing tests
|
||||
|
||||
Let's start with a really simple example. Say you have written a function to calculate factorials and now you want to test it (let's leave aside TDD for now).
|
||||
|
||||
@ -83,7 +85,7 @@ Now all the tests pass.
|
||||
|
||||
Of course there are still more issues to deal with. For example we'll hit problems when the return value starts to exceed the range of an unsigned int. With factorials that can happen quite quickly. You might want to add tests for such cases and decide how to handle them. We'll stop short of doing that here.
|
||||
|
||||
## What did we do here?
|
||||
### What did we do here?
|
||||
|
||||
Although this was a simple test it's been enough to demonstrate a few things about how Catch is used. Let's take moment to consider those before we move on.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user