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 a285e44
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1592,12 +1592,12 @@ jobs:
- name: Build
shell: bash
run: |
cmake --build build --target self_test custom_recursive_mutex
cmake --build build --target self_test custom_recursive_mutex thread_terror
- name: Run tests
shell: bash
run: |
./build/test/self_test
./build/test/self_test && ./build/test/custom_recursive_mutex && ./build/test/thread_terror
- name: Collect coverage
if: (!startsWith(matrix.config.name, 'windows'))
Expand Down
22 changes: 20 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,27 @@ 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 a285e44

Please sign in to comment.