diff --git a/README.md b/README.md index f9ac378a..523cb791 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,11 @@ extensions may require additional headers. ## How to use it This documentation comprises these three parts: -* [Why do we need yet another C++ Test Framework?](docs/why-catch.md) -* [Tutorial](docs/tutorial.md) - getting started -* [Reference section](docs/Readme.md) - all the details +* [Why do we need yet another C++ Test Framework?](docs/why-catch.md#top) +* [Tutorial](docs/tutorial.md#top) - getting started +* [Reference section](docs/Readme.md#top) - all the details ## More * Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/philsquared/Catch/issues) * For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum) -* See [who else is using Catch](docs/opensource-users.md) +* See [who else is using Catch](docs/opensource-users.md#top) diff --git a/docs/Readme.md b/docs/Readme.md index 27aaedb4..b1623626 100644 --- a/docs/Readme.md +++ b/docs/Readme.md @@ -1,31 +1,31 @@ -To get the most out of Catch, start with the [tutorial](tutorial.md). +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. Writing tests: -* [Assertion macros](assertions.md) -* [Matchers](matchers.md) -* [Logging macros](logging.md) -* [Test cases and sections](test-cases-and-sections.md) -* [Test fixtures](test-fixtures.md) -* [Reporters](reporters.md) -* [Event Listeners](event-listeners.md) +* [Assertion macros](assertions.md#top) +* [Matchers](matchers.md#top) +* [Logging macros](logging.md#top) +* [Test cases and sections](test-cases-and-sections.md#top) +* [Test fixtures](test-fixtures.md#top) +* [Reporters](reporters.md#top) +* [Event Listeners](event-listeners.md#top) Fine tuning: -* [Supplying your own main()](own-main.md) -* [Compile-time configuration](configuration.md) -* [String Conversions](tostring.md) +* [Supplying your own main()](own-main.md#top) +* [Compile-time configuration](configuration.md#top) +* [String Conversions](tostring.md#top) Running: -* [Command line](command-line.md) -* [CI and Build system integration](build-systems.md) +* [Command line](command-line.md#top) +* [CI and Build system integration](build-systems.md#top) FAQ: -* [Why are my tests slow to compile?](slow-compiles.md) -* [Known limitations](limitations.md) +* [Why are my tests slow to compile?](slow-compiles.md#top) +* [Known limitations](limitations.md#top) Other: -* [Why Catch?](why-catch.md) -* [Open Source Projects using Catch](opensource-users.md) -* [Contributing](contributing.md) -* [Release Notes](release-notes.md) +* [Why Catch?](why-catch.md#top) +* [Open Source Projects using Catch](opensource-users.md#top) +* [Contributing](contributing.md#top) +* [Release Notes](release-notes.md#top) diff --git a/docs/assertions.md b/docs/assertions.md index d6699eef..3150b584 100644 --- a/docs/assertions.md +++ b/docs/assertions.md @@ -132,7 +132,7 @@ REQUIRE_NOTHROW([&](){ ## Matcher expressions -To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md). +To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md#top). * **REQUIRE_THAT(** _lhs_, _matcher expression_ **)** and * **CHECK_THAT(** _lhs_, _matcher expression_ **)** @@ -146,4 +146,4 @@ For more details, along with workarounds, see the section on [the limitations pa --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/build-systems.md b/docs/build-systems.md index 30d99c14..1033490d 100644 --- a/docs/build-systems.md +++ b/docs/build-systems.md @@ -141,4 +141,4 @@ If you are using GCOV tool to get testing coverage of your code, and are not sur --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/command-line.md b/docs/command-line.md index 8b546126..0e1a7af8 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -299,4 +299,4 @@ So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be t --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/commercial-users.md b/docs/commercial-users.md index 60101441..e4d789f1 100644 --- a/docs/commercial-users.md +++ b/docs/commercial-users.md @@ -1,7 +1,7 @@ # Commercial users of Catch -As well as [Open Source](opensource-users.md) users Catch is widely used within proprietary code bases too. +As well as [Open Source](opensource-users.md#top) users Catch is widely used within proprietary code bases too. Many organisations like to keep this information internal, and that's fine, but if you're more open it would be great if we could list the names of as many organisations as possible that use Catch somewhere in their codebase. diff --git a/docs/configuration.md b/docs/configuration.md index d2003065..35809ab4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -102,4 +102,4 @@ On Windows Catch includes `windows.h`. To minimize global namespace clutter in t --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/contributing.md b/docs/contributing.md index ab831d4c..b6150375 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -58,4 +58,4 @@ be fairly self-explanatory. --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/event-listeners.md b/docs/event-listeners.md index a63b3ba2..b9331b49 100644 --- a/docs/event-listeners.md +++ b/docs/event-listeners.md @@ -72,4 +72,4 @@ just look in the source code to see what fields are available. --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/logging.md b/docs/logging.md index 88adfc8b..7ae54aab 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -80,4 +80,4 @@ These macros are now deprecated and are just aliases for INFO and CAPTURE (which --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/matchers.md b/docs/matchers.md index acbcbb85..647ec64f 100644 --- a/docs/matchers.md +++ b/docs/matchers.md @@ -102,4 +102,4 @@ with expansion: --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/opensource-users.md b/docs/opensource-users.md index c1e93d0f..d23f4140 100644 --- a/docs/opensource-users.md +++ b/docs/opensource-users.md @@ -84,4 +84,4 @@ Standardese aims to be a nextgen Doxygen --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/own-main.md b/docs/own-main.md index 2b6d032e..23f472e2 100644 --- a/docs/own-main.md +++ b/docs/own-main.md @@ -84,4 +84,4 @@ Catch embeds a powerful command line parser which you can also use to parse your --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/release-notes.md b/docs/release-notes.md index d9c658fd..2c4765fe 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -153,7 +153,7 @@ * This means it reports `INFO` messages on success, if output on success (`-s`) is enabled. * Previously it only reported `INFO` messages on failure. * `CAPTURE(expr)` now stringifies `expr` in the same way assertion macros do (#639) -* Listeners are now finally [documented](event-listeners.md). +* Listeners are now finally [documented](event-listeners.md#top). * Listeners provide a way to hook into events generated by running your tests, including start and end of run, every test case, every section and every assertion. @@ -192,7 +192,7 @@ Cygwin issue with `gettimeofday` - `#define` was not early enough * Matchers have new, simpler (and documented) interface. * Catch provides string and vector matchers. - * For details see [Matchers documentation](matchers.md). + * For details see [Matchers documentation](matchers.md#top). * Changed console reporter test duration reporting format (#322) * Old format: `Some simple comparisons between doubles completed in 0.000123s` * New format: `xxx.123s: Some simple comparisons between doubles` _(There will always be exactly 3 decimal places)_ @@ -203,10 +203,10 @@ Cygwin issue with `gettimeofday` - `#define` was not early enough * _More changes are coming_ * Added [TAP (Test Anything Protocol)](https://testanything.org/) and [Automake](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) reporters. * These are not present in the default single-include header and need to be downloaded from GitHub separately. - * For details see [documentation about integrating with build systems](build-systems.md). + * For details see [documentation about integrating with build systems](build-systems.md#top). * XML reporter now reports filename as part of the `Section` and `TestCase` tags. * `Approx` now supports an optional margin of absolute error - * It has also received [new documentation](assertions.md). + * It has also received [new documentation](assertions.md#top). ### Fixes * Silenced C4312 ("conversion from int to 'ClassName *") warnings in the evaluate layer. @@ -249,7 +249,7 @@ Other: ### Fixes: * Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`. * Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC. - * For specifics, look into the [documentation](configuration.md). + * For specifics, look into the [documentation](configuration.md#top). * Fixed compilation error under MinGW caused by improper compiler detection. * Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception. * Fixed XML reporter not reporting captured stdout/stderr. @@ -263,7 +263,7 @@ Other: * Microbenchmark focused on Catch's overhead went from ~3.4s to ~0.7s. * Real world test using [JSON for Modern C++](https://github.com/nlohmann/json)'s test suite went from ~6m 25s to ~4m 14s. * Catch can now run specific sections within test cases. - * For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md). + * For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md#top). * Catch now supports SEH on Windows as well as signals on Linux. * After receiving a signal, Catch reports failing assertion and then passes the signal onto the previous handler. * Approx can be used to compare values against strong typedefs (available in C++11 mode only). @@ -300,7 +300,7 @@ Other: * Approval tests can now be run on Windows * CMake will now warn if a file is present in the `include` folder but not is not enumerated as part of the project * Catch now defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including `windows.h` - * This can be disabled if needed, see [documentation](configuration.md) for details. + * This can be disabled if needed, see [documentation](configuration.md#top) for details. ## 1.6.0 @@ -329,4 +329,4 @@ Release notes were not maintained prior to v1.6.0, but you should be able to wor --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/reporters.md b/docs/reporters.md index 7c8e4204..78e78ee9 100644 --- a/docs/reporters.md +++ b/docs/reporters.md @@ -43,4 +43,4 @@ but do keep in mind upcoming changes (these will be minor, simplifying, changes --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/slow-compiles.md b/docs/slow-compiles.md index 0b609f68..d1806d03 100644 --- a/docs/slow-compiles.md +++ b/docs/slow-compiles.md @@ -19,7 +19,7 @@ Because Catch is implemented *entirely* in headers you might think that the whol As a result the main source file *does* compile the whole of Catch every time! So it makes sense to dedicate this file to *only* ```#define```-ing the identifier and ```#include```-ing Catch (and implementing the runner code, if you're doing that). Keep all your test cases in other files. This way you won't pay the recompilation cost for the whole of Catch ## Practical example -Assume you have the `Factorial` function from the [tutorial](tutorial.md) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`: +Assume you have the `Factorial` function from the [tutorial](tutorial.md#top) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`: ```cpp // tests-main.cpp @@ -62,4 +62,4 @@ You can also opt to sacrifice some features in order to speed-up Catch's compila --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md index 45269044..7d26226e 100644 --- a/docs/test-cases-and-sections.md +++ b/docs/test-cases-and-sections.md @@ -12,7 +12,7 @@ Test cases and sections are very easy to use in practice: _test name_ and _section name_ are free form, quoted, strings. The optional _tags_ argument is a quoted string containing one or more tags enclosed in square brackets. Tags are discussed below. Test names must be unique within the Catch executable. -For examples see the [Tutorial](tutorial.md) +For examples see the [Tutorial](tutorial.md#top) ## Tags @@ -86,4 +86,4 @@ Other than the additional prefixes and the formatting in the console reporter th --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md index bfbd0aa3..c887ce26 100644 --- a/docs/test-fixtures.md +++ b/docs/test-fixtures.md @@ -30,4 +30,4 @@ The two test cases here will create uniquely-named derived classes of UniqueTest --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/tostring.md b/docs/tostring.md index 8a2939e5..cfca0533 100644 --- a/docs/tostring.md +++ b/docs/tostring.md @@ -45,4 +45,4 @@ CATCH_TRANSLATE_EXCEPTION( MyType& ex ) { --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/tutorial.md b/docs/tutorial.md index 833d3a02..f4bcb07d 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -40,7 +40,7 @@ TEST_CASE( "Factorials are computed", "[factorial]" ) { } ``` -This will compile to a complete executable which responds to [command line arguments](command-line.md). If you just run it with no arguments it will execute all test cases (in this case there is just one), report any failures, report a summary of how many tests passed and failed and return the number of failed tests (useful for if you just want a yes/ no answer to: "did it work"). +This will compile to a complete executable which responds to [command line arguments](command-line.md#top). If you just run it with no arguments it will execute all test cases (in this case there is just one), report any failures, report a summary of how many tests passed and failed and return the number of failed tests (useful for if you just want a yes/ no answer to: "did it work"). If you run this as written it will pass. Everything is good. Right? Well, there is still a bug here. In fact the first version of this tutorial I posted here genuinely had the bug in! So it's not completely contrived (thanks to Daryle Walker (```@CTMacUser```) for pointing this out). @@ -87,8 +87,8 @@ Of course there are still more issues to deal with. For example we'll hit proble 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. -1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md)). -2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see Test cases and Sections, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md) for more information on running tests. +1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md#top). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md#top)). +2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see Test cases and Sections, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md#top) for more information on running tests. 3. The name and tags arguments are just strings. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you, and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names. 4. We write our individual test assertions using the ```REQUIRE``` macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced. @@ -162,7 +162,7 @@ Sections can be nested to an arbitrary depth (limited only by your stack size). ## BDD-Style -If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively. For more details see [Test cases and sections](test-cases-and-sections.md). +If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively. For more details see [Test cases and sections](test-cases-and-sections.md#top). The vector example can be adjusted to use these macros like so: @@ -225,7 +225,7 @@ Scenario: vectors can be sized and resized To keep the tutorial simple we put all our code in a single file. This is fine to get started - and makes jumping into Catch even quicker and easier. As you write more real-world tests, though, this is not really the best approach. -The requirement is that the following block of code ([or equivalent](own-main.md)): +The requirement is that the following block of code ([or equivalent](own-main.md#top)): ```c++ #define CATCH_CONFIG_MAIN @@ -234,7 +234,7 @@ The requirement is that the following block of code ([or equivalent](own-main.md appears in _exactly one_ source file. Use as many additional cpp files (or whatever you call your implementation files) as you need for your tests, partitioned however makes most sense for your way of working. Each additional file need only ```#include "catch.hpp"``` - do not repeat the ```#define```! -In fact it is usually a good idea to put the block with the ```#define``` [in its own source file](slow-compiles.md). +In fact it is usually a good idea to put the block with the ```#define``` [in its own source file](slow-compiles.md#top). Do not write your tests in header files! @@ -243,8 +243,8 @@ Do not write your tests in header files! This has been a brief introduction to get you up and running with Catch, and to point out some of the key differences between Catch and other frameworks you may already be familiar with. This will get you going quite far already and you are now in a position to dive in and write some tests. -Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the ever-growing [Reference section](Readme.md) for what's available. +Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the ever-growing [Reference section](Readme.md#top) for what's available. --- -[Home](Readme.md) +[Home](Readme.md#top) diff --git a/docs/why-catch.md b/docs/why-catch.md index fce02bcd..45f58a6a 100644 --- a/docs/why-catch.md +++ b/docs/why-catch.md @@ -37,10 +37,10 @@ So what does Catch bring to the party that differentiates it from these? Apart f ## Who else is using Catch? -See the list of [open source projects using Catch](opensource-users.md). +See the list of [open source projects using Catch](opensource-users.md#top). -See the [tutorial](tutorial.md) to get more of a taste of using Catch in practice +See the [tutorial](tutorial.md#top) to get more of a taste of using Catch in practice --- -[Home](Readme.md) +[Home](Readme.md#top)