{"id":13521335,"url":"https://github.com/clean-test/clean-test","last_synced_at":"2025-03-31T20:31:14.494Z","repository":{"id":39714929,"uuid":"313088453","full_name":"clean-test/clean-test","owner":"clean-test","description":"A modern C++-20 testing framework.","archived":false,"fork":false,"pushed_at":"2024-05-26T22:10:28.000Z","size":345,"stargazers_count":49,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-02T05:32:49.725Z","etag":null,"topics":["c-plus-plus","cpp","cpp20","testing","unit-testing"],"latest_commit_sha":null,"homepage":"https://clean-test.dev","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/clean-test.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/CleanTestConfig.cmake","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-15T17:45:20.000Z","updated_at":"2024-09-23T08:15:34.000Z","dependencies_parsed_at":"2023-12-21T22:22:30.911Z","dependency_job_id":"35140c31-e310-42d7-bfc9-58b05d069dd7","html_url":"https://github.com/clean-test/clean-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clean-test%2Fclean-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clean-test%2Fclean-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clean-test%2Fclean-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clean-test%2Fclean-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clean-test","download_url":"https://codeload.github.com/clean-test/clean-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246535856,"owners_count":20793333,"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":["c-plus-plus","cpp","cpp20","testing","unit-testing"],"created_at":"2024-08-01T06:00:32.910Z","updated_at":"2025-03-31T20:31:14.196Z","avatar_url":"https://github.com/clean-test.png","language":"C++","readme":".. Copyright m8mble 2020.\n   SPDX-License-Identifier: BSL-1.0\n\n.. |Clean Test Logo| raw:: html\n\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"doc/logo/logo-dark.svg\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"doc/logo/logo-light.svg\"\u003e\n    \u003cimg src=\"doc/logo/logo-light.svg\" width=\"80%\"\u003e\n  \u003c/picture\u003e\n\n*****************\n|Clean Test Logo|\n*****************\n\n.. image:: https://github.com/clean-test/clean-test/actions/workflows/gcc.yml/badge.svg?branch=main\n   :target: https://github.com/clean-test/clean-test/actions/workflows/gcc.yml\n.. image:: https://github.com/clean-test/clean-test/actions/workflows/clang.yml/badge.svg?branch=main\n   :target: https://github.com/clean-test/clean-test/actions/workflows/clang.yml\n.. image:: https://github.com/clean-test/clean-test/actions/workflows/msvc.yml/badge.svg?branch=main\n   :target: https://github.com/clean-test/clean-test/actions/workflows/msvc.yml\n.. image:: https://github.com/clean-test/clean-test/actions/workflows/doc.yml/badge.svg?branch=main\n   :target: https://github.com/clean-test/clean-test/actions/workflows/doc.yml\n.. image:: https://img.shields.io/badge/c%2B%2B-20-informational\n   :target: https://en.wikipedia.org/wiki/C%2B%2B20\n.. image:: https://img.shields.io/badge/license-BSL--1.0-informational\n   :target: LICENSE.txt\n\nA modern C++-20 unit-testing framework.\n\n\n==========\nMotivation\n==========\n\nMany unit-testing frameworks have been released so far.\nYet none combines the following qualities:\n\n* **Macro free**:\n  expression introspection without macros,\n  leverages modern C++-20,\n  easy to discover.\n\n* **Parallel**:\n  executes any number of tests simultaneously,\n  utilizes all CPU cores,\n  reliably reports failures.\n\n* **Production ready**:\n  easy to integrate as CMake library without dependencies,\n  JUnit reports,\n  UTF-8 support,\n  flexible runtime configuration.\n\nFurther details are elaborated in the `official documentation \u003chttps://clean-test.github.io\u003e`_.\n\n\n=====\nDemo\n=====\n\n.. role:: cpp(code)\n   :language: cpp\n\nLet's start with a basic example:\nConsider a standard :cpp:`sum` function together with three tests to ensure its correctness.\n\n.. code-block:: cpp\n\n   #include \u003cclean-test/clean-test.h\u003e\n\n   constexpr auto sum(auto... vs) { return (0 + ... + vs); }\n\n   namespace ct = clean_test;\n   using namespace ct::literals;\n\n   auto const suite = ct::Suite{\"sum\", [] {\n       \"0\"_test = [] { ct::expect(sum() == 0_i); };\n       \"3\"_test = [] { ct::expect(sum(1, 2) == 1 + 2_i); };\n       \"A\"_test = [] { ct::expect(sum(-1) \u003c 0_i and sum(+1) \u003e 0_i); };\n   }};\n\nSince ``sum`` is correctly implemented, all tests will succeed.\nBut what would happen if we made a mistake and wrote\n:cpp:`constexpr auto sum(auto... vs) { return (10 + ... + vs); }` instead?\n\n.. code-block:: none\n\n   Failure in ../test/Demo.cpp:12\n   ( 10 == 0 )\n   Failure in ../test/Demo.cpp:13\n   ( 13 == ( 1 + 2 ) )\n   Failure in ../test/Demo.cpp:14\n   ( ( 9 \u003c 0 ) and \u003cunknown\u003e )\n\nClean Test shows how different parts of an :code:`ct::expect`-ation are evaluated.\nThis works for constants, temporaries and even short circuiting operators alike.\nThe user-defined literals from :cpp:`namespace clean_test::literals` can be used to support this introspection\nbut are not mandatory.\n\nBy default Clean Test utilizes all available hardware threads to execute tests in parallel.\nFailure detection and reporting are thread-safe - even if your tests are parallel themselves.\n\nAll aspects of test execution can be configured dynamically.\nIt is possible to specify at runtime\nwhich test cases should be selected, how they should be executed and what kind of reporting is desired.\nClean Test ensures valid UTF-8 reports and thus can safely be utilized in your CI-pipelines.\n\n\n======\nVideo\n======\n\nDetails about Clean Test were presented at Meeting C++ 2022 in Berlin:\n\n.. image:: https://img.youtube.com/vi/JF83GGNvvM8/0.jpg\n    :alt: Clean Test at Meeting C++ 2022\n    :target: https://www.youtube.com/watch?v=JF83GGNvvM8\n    :align: center\n\n======\nStatus\n======\n\nClean Test already provides all core features, but currently still lacks some convenience functionality.\nThere is a list of `envisioned features \u003cdoc/status.md\u003e`_ that will be added in the coming weeks and months.\n\nClean Test consists of 100% standard C++-20 and works with any modern compiler toolchain.\nIt works with gcc (version 10 and above) and Clang (version 11 and above) on Linux as well as\nwith MSVC (version 19.29 and above) on Windows.\n","funding_links":[],"categories":["Libraries","测试框架"],"sub_categories":["Testing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclean-test%2Fclean-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclean-test%2Fclean-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclean-test%2Fclean-test/lists"}