{"id":13392474,"url":"https://github.com/catchorg/Catch2","last_synced_at":"2025-03-13T18:31:49.414Z","repository":{"id":1169311,"uuid":"1062572","full_name":"catchorg/Catch2","owner":"catchorg","description":"A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)","archived":false,"fork":false,"pushed_at":"2024-10-29T20:07:01.000Z","size":28223,"stargazers_count":18645,"open_issues_count":424,"forks_count":3053,"subscribers_count":441,"default_branch":"devel","last_synced_at":"2024-10-29T22:41:32.791Z","etag":null,"topics":["bdd","cpp","cpp14","framework","no-dependencies","tdd","test-framework","testing"],"latest_commit_sha":null,"homepage":"https://discord.gg/4CWS9zD","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catchorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"horenmar","custom":"https://www.paypal.me/horenmar"}},"created_at":"2010-11-08T18:22:56.000Z","updated_at":"2024-10-29T20:07:09.000Z","dependencies_parsed_at":"2023-07-05T18:48:59.224Z","dependency_job_id":"b6589a7e-96be-47af-92b6-702f1b8a1eb2","html_url":"https://github.com/catchorg/Catch2","commit_stats":{"total_commits":4293,"total_committers":415,"mean_commits":"10.344578313253011","dds":0.5644071744700676,"last_synced_commit":"4e8d92bf02f7d1c8006a0e7a5ecabd8e62d98502"},"previous_names":["philsquared/catch"],"tags_count":134,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catchorg%2FCatch2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catchorg%2FCatch2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catchorg%2FCatch2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catchorg%2FCatch2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catchorg","download_url":"https://codeload.github.com/catchorg/Catch2/tar.gz/refs/heads/devel","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243459104,"owners_count":20294340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdd","cpp","cpp14","framework","no-dependencies","tdd","test-framework","testing"],"created_at":"2024-07-30T17:00:21.531Z","updated_at":"2025-03-13T18:31:49.371Z","avatar_url":"https://github.com/catchorg.png","language":"C++","funding_links":["https://github.com/sponsors/horenmar","https://www.paypal.me/horenmar"],"categories":["Best Practices","C++","Debug","Packages, Libraries and RTOSes","Containers \u0026 Language Extentions \u0026 Linting","Testing Frameworks","Code Stability","C/C++ 程序设计","Awesome Tools","Unit Testing","Test Frameworks","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++","testing","Libraries","Libraries and Frameworks","C++: [cpp](http://clang.org)","Projects","RAOE Camera","Framework and Libraries"],"sub_categories":["Testing","For C++/C","UI Test Automation Scripting","网络服务_其他","Languages","General Embedded Testing Frameworks","Debugging and Profiling","Libraries","Dependencies","Testing and Mocking Framework"],"readme":"\u003ca id=\"top\"\u003e\u003c/a\u003e\n![Catch2 logo](data/artwork/catch2-logo-small-with-background.png)\n\n[![Github Releases](https://img.shields.io/github/release/catchorg/catch2.svg)](https://github.com/catchorg/catch2/releases)\n[![Linux build status](https://github.com/catchorg/Catch2/actions/workflows/linux-simple-builds.yml/badge.svg)](https://github.com/catchorg/Catch2/actions/workflows/linux-simple-builds.yml)\n[![Linux build status](https://github.com/catchorg/Catch2/actions/workflows/linux-other-builds.yml/badge.svg)](https://github.com/catchorg/Catch2/actions/workflows/linux-other-builds.yml)\n[![MacOS build status](https://github.com/catchorg/Catch2/actions/workflows/mac-builds.yml/badge.svg)](https://github.com/catchorg/Catch2/actions/workflows/mac-builds.yml)\n[![Build Status](https://ci.appveyor.com/api/projects/status/github/catchorg/Catch2?svg=true\u0026branch=devel)](https://ci.appveyor.com/project/catchorg/catch2)\n[![Code Coverage](https://codecov.io/gh/catchorg/Catch2/branch/devel/graph/badge.svg)](https://codecov.io/gh/catchorg/Catch2)\n[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://godbolt.org/z/EdoY15q9G)\n[![Join the chat in Discord: https://discord.gg/4CWS9zD](https://img.shields.io/badge/Discord-Chat!-brightgreen.svg)](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 \u003ccatch2/catch_test_macros.hpp\u003e\n\n#include \u003ccstdint\u003e\n\nuint32_t factorial( uint32_t number ) {\n    return number \u003c= 1 ? number : factorial(number-1) * number;\n}\n\nTEST_CASE( \"Factorials are computed\", \"[factorial]\" ) {\n    REQUIRE( factorial( 1) == 1 );\n    REQUIRE( factorial( 2) == 2 );\n    REQUIRE( factorial( 3) == 6 );\n    REQUIRE( factorial(10) == 3'628'800 );\n}\n```\n\n**Example microbenchmark**\n```cpp\n#include \u003ccatch2/catch_test_macros.hpp\u003e\n#include \u003ccatch2/benchmark/catch_benchmark.hpp\u003e\n\n#include \u003ccstdint\u003e\n\nuint64_t fibonacci(uint64_t number) {\n    return number \u003c 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 is currently still ongoing.\n\nFor migrating from the v2 releases to v3, you should look at [our\ndocumentation](docs/migrate-v2-to-v3.md#top). It provides a simple\nguidelines on getting started, and collects most common migration\nproblems.\n\nFor the previous major version of Catch2 [look into the `v2.x` branch\nhere on GitHub](https://github.com/catchorg/Catch2/tree/v2.x).\n\n\n## How to use it\nThis documentation comprises these three parts:\n\n* [Why do we need yet another C++ Test Framework?](docs/why-catch.md#top)\n* [Tutorial](docs/tutorial.md#top) - getting started\n* [Reference section](docs/Readme.md#top) - all the details\n\n\n## More\n* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/catchorg/Catch2/issues)\n* For discussion or questions please use [our Discord](https://discord.gg/4CWS9zD)\n* See who else is using Catch2 in [Open Source Software](docs/opensource-users.md#top)\nor [commercially](docs/commercial-users.md#top).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatchorg%2FCatch2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatchorg%2FCatch2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatchorg%2FCatch2/lists"}