Open elheck opened 2 years ago
@elheck You might want to look into FakeIt, which is a really simple C++ mocking/stubbing library I've used in the past. It still requires virtual classes though.
Thanks I will have a look
There is a very nice approach for C (but the idea is pretty generic) in a project called cmocka. The idea is to use the linker for wrapping the functions you wish to mock with --wrap flag and provide your version (Example) . It's very linker dependent, but there is a great benefit since you can mock everything regardless of how it's used, in addition you can mock system functions as well (open(), read() etc')
Channel C++ Weekly
Topics
There are powerful unittesting, mocking and stubbing libraries out there like gtest and gmock and others, but in order to mock a existing class, it needs a pure virtual class to be cleanly mocked. Are there alternatives? Setting the behavior of mocks is often done in nested lambdas like so:
Is there a cleaner way?
Length
10-20