{"id":13418991,"url":"https://github.com/rollbear/trompeloeil","last_synced_at":"2026-02-20T18:33:01.137Z","repository":{"id":21799001,"uuid":"25121543","full_name":"rollbear/trompeloeil","owner":"rollbear","description":"Header only C++14 mocking framework","archived":false,"fork":false,"pushed_at":"2025-04-26T06:38:38.000Z","size":2859,"stargazers_count":870,"open_issues_count":60,"forks_count":89,"subscribers_count":30,"default_branch":"main","last_synced_at":"2026-02-13T17:29:07.077Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rollbear.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE_1_0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-12T14:23:48.000Z","updated_at":"2026-02-04T20:06:04.000Z","dependencies_parsed_at":"2023-02-15T06:01:51.366Z","dependency_job_id":"688f42f8-a39d-459e-8954-829c3f2dc847","html_url":"https://github.com/rollbear/trompeloeil","commit_stats":null,"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"purl":"pkg:github/rollbear/trompeloeil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbear%2Ftrompeloeil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbear%2Ftrompeloeil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbear%2Ftrompeloeil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbear%2Ftrompeloeil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rollbear","download_url":"https://codeload.github.com/rollbear/trompeloeil/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbear%2Ftrompeloeil/sbom","scorecard":{"id":783408,"data":{"date":"2025-08-11","repo":{"name":"github.com/rollbear/trompeloeil","commit":"2a633b923f32cebc336dc8a6a77e4c04f2238106"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":1,"reason":"Found 2/13 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:1779: update your workflow using https://app.stepsecurity.io/secureworkflow/rollbear/trompeloeil/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:1783: update your workflow using https://app.stepsecurity.io/secureworkflow/rollbear/trompeloeil/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:1867: update your workflow using https://app.stepsecurity.io/secureworkflow/rollbear/trompeloeil/ci.yml/main?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE_1_0.txt:0","Info: FSF or OSI recognized license: Boost Software License 1.0: LICENSE_1_0.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T05:27:10.137Z","repository_id":21799001,"created_at":"2025-08-23T05:27:10.138Z","updated_at":"2025-08-23T05:27:10.138Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29660040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-07-30T22:01:09.846Z","updated_at":"2026-02-20T18:33:01.120Z","avatar_url":"https://github.com/rollbear.png","language":"C++","funding_links":["https://www.buymeacoffee.com/bjornfahller"],"categories":["TODO scan for Android support in followings","Packages, Libraries and RTOSes","C++","Mocking"],"sub_categories":["Testing"],"readme":"# *Trompeloeil*\n\n![trompeloeil logo](trompeloeil-logo.png)\n\n\u003c!-- markdownlint-disable no-space-in-links --\u003e\n![CI](https://github.com/rollbear/trompeloeil/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/rollbear/trompeloeil/branch/master/graph/badge.svg?token=PCUO4knwdU)](https://codecov.io/gh/rollbear/trompeloeil)\n\nGet: [![Conan](https://img.shields.io/badge/on-conan-blue.svg)](https://conan.io/center/trompeloeil)\n\n\u003ca href=\"https://www.buymeacoffee.com/bjornfahller\"\u003e \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-orange.png\" height=\"50\" width=\"210\" alt=\"Buy me a coffee\"/\u003e\u003c/a\u003e\n\n\u003e *trompe l'oeil* noun    (Concise Encyclopedia)\n\u003e Style of representation in which a painted object is intended\n\u003e to deceive the viewer into believing it is the object itself...\n\n# What is it?\n\nA thread-safe header-only mocking framework for C++11/14 using the Boost Software License 1.0\n\n# Documentation\n\n- [Integrating with unit test frame works](docs/CookBook.md/#unit_test_frameworks)\n- [Introduction](https://playfulprogramming.blogspot.com/2014/12/introducing-trompeloeil-c-mocking.html)\n- [Building and running the self test suite](#self_test)\n- [How to contribute](#contribute)\n- [Compiler compatibility](#compilers)\n- [External tools](#tools)\n- [Presentation videos](#videos)\n- [Trompeloeil on CppCast](http://cppcast.com/2017/02/bjorn-fahller/)\n- [Cheat Sheet (2*A4)](docs/trompeloeil_cheat_sheet.pdf)\n- [Cook Book](docs/CookBook.md)\n- [FAQ](docs/FAQ.md)\n- [Backward compatibility with earlier versions of C++](docs/Backward.md)\n- [Platform and library support for Trompeloeil](docs/PlatformsAndLibraries.md)\n- [Reference](docs/reference.md)\n\nAlso, follow up with the post on\n[sequencing](\n  https://playfulprogramming.blogspot.se/2015/01/sequence-control-with-trompeloeil-c.html\n) for examples on how to restrict or relax allowed sequences of matching calls.\n\n# Teaser\n\n```Cpp\n#include \u003ctrompeloeil.hpp\u003e\n\nclass Interface\n{\npublic:\n  virtual ~Interface() = default;\n  virtual bool foo(int, std::string\u0026 s) = 0;\n  virtual bool bar(int) = 0;\n  virtual bool bar(std::string) = 0;\n};\n\nvoid interface_func(Interface*); // function to test\n\nclass Mock : public Interface\n{\npublic:\n  MAKE_MOCK(foo, auto (int, std::string\u0026) -\u003e bool, override);\n  MAKE_MOCK(bar, auto (int) -\u003e bool, override);\n  MAKE_MOCK(bar, auto (std::string) -\u003e bool, override);\n  MAKE_MOCK0(baz, void()); // not from Interface\n};\n\nTEST(exercise_interface_func)\n{\n  using trompeloeil::_;  // wild card for matching any value\n  using trompeloeil::gt; // greater-than match\n\n  Mock m;\n\n  trompeloeil::sequence seq1, seq2;  // control order of matching calls\n\n  int local_var = 0;\n\n  REQUIRE_CALL(m, bar(ANY(int)))     // expect call to m.bar(int)\n    .LR_SIDE_EFFECT(local_var = _1)  // set captured variable to value of param\n    .RETURN(_1 \u003e 0)                  // return value depending on param value\n    .IN_SEQUENCE(seq1)               // must be first match for seq1\n    .TIMES(AT_LEAST(1));             // can be called several times\n\n  FORBID_CALL(m, bar(0));            // but m.bar(0) is not allowed\n\n  REQUIRE_CALL(m, bar(\"word\"))       // expect one call to m.bar(std::string)\n    .RETURN(true)\n    .IN_SEQUENCE(seq2);              // must be first match for seq2\n\n  REQUIRE_CALL(m, foo(gt(2), _))     // expect call to foo(int,std::string\u0026)\n    .WITH(_2 == \"\")                  // with int \u003e 2 and empty string\n    .IN_SEQUENCE(seq1, seq2)         // last for both seq1 and seq2\n    .SIDE_EFFECT(_2 = \"cat\")         // and set param string to \"cat\"\n    .RETURN(true);\n\n  interface_func(\u0026m);\n\n  // all the above expectations must be fulfilled here\n}\n```\n\n# \u003cA name=\"self_test\"/\u003e Building and running the self test suite\n\nTo build the self test suite run `cmake` with `-DTROMPELOEIL_BUILD_TESTS=yes`.\nUse the options `CXX_STANDARD` to select which C++ standard to test, and\n`SANITIZE` to select sanitizers to build with. Note that the self tests needs a\nreasonably modern version of CMake. Example:\n\n```\ncmake -B build_dir \\\n      -D TROMPELOEIL_BUILD_TESTS=yes \\\n      -D CMAKE_BUILD_TYPE=Debug \\\n      -D CXX_STANDARD=17 \\\n      -D SANITIZE=Address,Undefined \\\n      \u003ctrompeloeil source dir\u003e\n```\n\nIf the build finds a CMake package for `Catch2` it will use that, otherwise it\nwill download a header-only version of Catch2 v2.x.\n\n```\ncmake --build build_dir -t self_test thread_terror custom_recursive_mutex\n```\n\nThen run the built binaries:\n\n```\n./build_dir/self_test \u0026\u0026 ./build_dir/thread_terror \u0026\u0026 ./build_dir/custom_recursive_mutex\n```\n\n# \u003cA name=\"contribute\"/\u003e How to contribute\n\nContributions are most welcome. For new functionality, please file an issue as\nan enhancement request first, to get a discussion going about how to best\nimplement it. Also for bugfixes, it is good to file an issue, so that others can\nsee what the problem is and when it's solved. Internal changes are normally not\nmentioned in the ChangeLog - it should typically reflect what a user can see\n(however, performance improvements and silencing warnings are visible for\nusers.) Feel free to add your name to the copyright blurb.\n\n|Change                       | PR to          |\n|-----------------------------|----------------|\n|Documentation                |master branch   |\n|Trivial bugfixes             |master branch   |\n|Non trivial bugfixes         |develop branch  |\n|Simple new functionality     |develop branch  |\n|Non-trivial new functionality|new topic branch|\n\n# \u003cA name=\"compilers\"/\u003e Compiler compatibility\n\nTrompeloeil is known to work with:\n\n- GCC [4.8.4](docs/Backward.md#gxx48x_limitations)+, 4.9.3+, 5, 6, 7, 8, 9, 10, 11, 12, 13\n- Clang 3.5, 3.6, 3.7, 3.8, 3.9, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17\n- Visual Studio 2015, 2017, 2019\n\nLatest patch level releases are assumed in the versions listed above.\n\nFurther details on C++11 support, platform and library limitations, may\nbe found in\n\n- [Backward compatibility with earlier versions of C++](docs/Backward.md)\n- [Platform and library support for Trompeloeil](docs/PlatformsAndLibraries.md)\n\n# \u003cA name=\"tools\"/\u003e External Tools\n\n- [ReSharperC++](https://www.jetbrains.com/resharper-cpp/) extension to\n  [VisualStudio](https://visualstudio.microsoft.com/) has a mock generator for\n  *Trompeloeil* since [2016.2](https://blog.jetbrains.com/rscpp/2016/09/14/whats-new-in-resharper-c-2016-2/)\n  \n# \u003cA name=\"videos\"/\u003e Videos\n|  |  |\n|--|--|\n| [![Mocking Modern C++ with Trompeloeil](https://img.youtube.com/vi/mPYNsARvTDk/mqdefault.jpg)](https://www.youtube.com/watch?v=mPYNsARvTDk)| *Mocking Modern C++ with Trompeloeil*, introduction to Trompeloeil by Björn Fahller from from from Stockholm C++ UG (34m)| [(Slides)](https://speakerdeck.com/rollbear/mocking-modern-c-plus-plus-with-trompeloeil) |\n| [![Using Trompeloeil, a Mocking Framework for Modern C++](https://img.youtube.com/vi/vvQ-kK4coYM/mqdefault.jpg)](https://www.youtube.com/watch?v=vvQ-kK4coYM)| *Using Trompeloeil, a Mocking Framework for Modern C++*, by Björn Fahller from NDC{Oslo} 2017 (52m) [(Slides)](https://speakerdeck.com/rollbear/ndc-oslo-using-trompeloeil-a-mocking-framework-for-modern-c-plus-plus) |\n| [![Using Trompeloeil, a Mocking Framework for Modern C++](https://img.youtube.com/vi/HCh6cs9nXt0/mqdefault.jpg)](https://www.youtube.com/watch?v=HCh6cs9nXt0) | *Using Trompeloeil, a Mocking Framework for Modern C++*, Detailed presentation by Björn Fahller from ACCU 2017 (1h25m) [(Slides with extra material)](https://speakerdeck.com/rollbear/using-trompeloeil-a-mocking-framework-for-modern-c-plus-plus) |\n| [![Packporting to the future](https://img.youtube.com/vi/KKvSVyZ4_5k/mqdefault.jpg)](https://www.youtube.com/watch?v=KKvSVyZ4_5k) | *Backporting to the Future*, Detailing the C++11 API and how it came to be, by Andrew Paxie from Pacific++ 2018 (53m) [(Slides)](https://github.com/pacificplusplus/conference/blob/master/slides-2018/backporting-to-the-future/slides.pdf) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollbear%2Ftrompeloeil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frollbear%2Ftrompeloeil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollbear%2Ftrompeloeil/lists"}