概要
Catch2は、C++テストフレームワークであり、簡潔で自然なテスト記述方法で知られています。セクション共有のセットアップ/クリーンアップ、BDDマクロ、基本的なマイクロベンチマーク機能をサポートしています。外部依存関係は不要で、単一ヘッダーファイルまたはコンパイル済みライブラリとして使用できます。
README プレビュー
\n\n\n[](https://github.com/catchorg/catch2/releases)\n[](https://github.com/catchorg/Catch2/actions/workflows/linux-simple-builds.yml)\n[](https://github.com/catchorg/Catch2/actions/workflows/linux-other-builds.yml)\n[](https://github.com/catchorg/Catch2/actions/workflows/mac-builds.yml)\n[](https://ci.appveyor.com/project/catchorg/catch2)\n[](https://codecov.io/gh/catchorg/Catch2)\n[](https://godbolt.org/z/EdoY15q9G)\n[](https://discord.gg/4CWS9zD)\n\n\n## What is Catch2?\n\nCatch2 is mainly a unit testing framework for C++, but it also\nprovides basic micro-benchmarking features, and simple BDD macros.\n\nCatch2's main advantage is that using it is both simple and natural.\nTest names do not have to be valid identifiers, assertions look like\nnormal C++ boolean expressions, and sections provide a nice and local way\nto share set-up and tear-down code in tests.\n\n**Example unit test**\n```cpp\n#include \n\n#include \n\nuint32_t factorial( uint32_t number ) {\n return number \n#include \n\n#include \n\nuint64_t fibonacci(uint64_t number) {\n return number < 2 ? number : fibonacci(number - 1) + fibonacci(number - 2);\n}\n\nTEST_CASE("Benchmark Fibonacci", "[!benchmark]") {\n REQUIRE(fibonacci(5) == 5);\n\n REQUIRE(fibonacci(20) == 6'765);\n BENCHMARK("fibonacci 20") {\n return fibonacci(20);\n };\n\n REQUIRE(fibonacci(25) == 75'025);\n BENCHMARK("fibonacci 25") {\n return fibonacci(25);\n };\n}\n```\n\n_Note that benchmarks are not run by default, so you need to run it explicitly\nwith the `[!benchmark]` tag._\n\n\n## Catch2 v3 has been released!\n\nYou are on the `devel` branch, where the v3 version is being developed.\nv3 brings a bunch of significant changes, the big one being that Catch2\nis no longer a single-header library. Catch2 now behaves as a normal\nlibrary, with multiple headers and separately compiled implementation.\n\nThe documentation is slowly being updated to take these changes into\naccount, but this work