trompeloeil | Header only C++14 mocking framework | Mock library
kandi X-RAY | trompeloeil Summary
kandi X-RAY | trompeloeil Summary
A thread-safe header-only mocking framework for C++11/14 using the Boost Software License 1.0.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of trompeloeil
trompeloeil Key Features
trompeloeil Examples and Code Snippets
Community Discussions
Trending Discussions on trompeloeil
QUESTION
When using Trompeloeil to mock unit tests in C++, how can use an unordered_map
as a return type?
ANSWER
Answered 2021-Jan-20 at 14:52Templated return types need to be wrapped in (...)
. This is explained in: Q. Why can't I mock a function that returns a template?
QUESTION
I have a project (with main.cpp
and some headers. Yes, it is a Catch2 test project as described in this blog). It compiles and runs.
My problem is: This project does nothing useful unless I add some more source files (my test cases). These source files use one header from the project and bring in some other dependencies as well (my library that I want to test).
The simple solution would be to copy this project, add the needed files and we are done.
Is there a better way? Currently with qmake I have the project defined in a catch.pri
file. By including this in an project I have everything for the qt and catch2 setup, and only have to define the files with the testcases by modifying the SOURCES
-Variable and the dependencies for the code to test.
Mapping this to CMake makes me ask questions:
First: when I include have a line like:
...ANSWER
Answered 2020-Jun-08 at 07:17Is there a better way?
No, this is how usually things are done. Any library / subproject is included using a .pri
file. You can, of course, make the subproject a git-submodule.
Can I define SOURCES in a later line?
Short answer: No
Example:
Lets say we have a small project with a single file a.cpp
and a CMakeLists.txt
as follows:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install trompeloeil
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page