Questions tagged [trompeloeil]

Questions related to the C++ mocking framework trompeloeil.

7 questions
3
votes
1 answer

How do fix a "RETURN missing for non-void function" error in tromeloeil?

I'm trying to figure out how to use the Trompeloeil library with C++11. With this example, I've run into a huge amount of build errors, and I can't understand why. #define CATCH_CONFIG_MAIN #include "catch.hpp" #include #include…
MightyDodongo
  • 101
  • 1
  • 4
2
votes
1 answer

Trompeloeil MAKE_MOCK0 with a template as a return type

When using Trompeloeil to mock unit tests in C++, how can use an unordered_map as a return type? // This example works fine // return type is void, my_function takes no arguments MAKE_MOCK0(my_function, void(), override); // This is what I'm…
J'e
  • 3,014
  • 4
  • 31
  • 55
2
votes
3 answers

How to create a template for creating a test executable using catch2 with qt and trompeloeil?

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…
user9400869
1
vote
0 answers

how to set the same expectation for an array of mock objects in trompeloeil?

I have an array of mocked objects and I need to provide the same expectation for many of them. I can only succeed in this by manually writing the expectation for each object of the array. the function under test struct IWheel { virtual bool…
Grim Fandango
  • 2,296
  • 1
  • 19
  • 27
1
vote
1 answer

Concise RAII for Trompeloeil mocks

I have classes like this: /* "Things" can be "zarked", but only when opened, and they must be closed afterwards */ class ThingInterface { public: // Open the thing for exclusive use virtual void Open(); // Zark the thing. virtual void…
Inductiveload
  • 6,094
  • 4
  • 29
  • 55
1
vote
0 answers

How to join separated TDD execution flows using trompeloeil?

Using the trompeloeil unit test framework and TDD: https://github.com/rollbear/trompeloeil/blob/master/docs/reference.md Given the following test cases Testcase 1: Expectation_A: a() is called Expectation_B: b() is called Testcase 2: …
Joki
  • 9
  • 1
  • 2
0
votes
1 answer

Mock call not being detected

I created a test case with Catch2 and I am trying to use TrompeLoeil for finer testing. However the mock calls either don't happen at all, or happen but don't seem to be detecting by the framework. Here is a minimal reproductible example : class…
Mickaël C. Guimarães
  • 1,020
  • 2
  • 14
  • 32