Skip to content

Commit

Permalink
Make sure the default report funcs are exercised from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rollbear committed Nov 3, 2023
1 parent 6087688 commit bf0f82e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/custom_recursive_mutex.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define TROMPELOEIL_CUSTOM_RECURSIVE_MUTEX
#include <trompeloeil.hpp>
#include <cassert>

namespace trompeloeil {

Expand All @@ -20,10 +21,26 @@ std::unique_ptr<custom_recursive_mutex> create_custom_recursive_mutex() {

class C {
public:
MAKE_MOCK0(func, int(void));
MAKE_MOCK1(func, int(int));
};

using trompeloeil::_;

int main() {
C c;
std::puts("Pass! (the program compiled)");
{
REQUIRE_CALL_V(c, func(_),
.RETURN(_1 + 1));
auto v = c.func(1);
assert(v == 2);
}
try {
REQUIRE_CALL_V(c, func(1), .RETURN(0));
c.func(0);
}
catch (trompeloeil::expectation_violation&)
{

}
std::puts("Pass!");
}

0 comments on commit bf0f82e

Please sign in to comment.