How to Mock Any Dependency in C++

1 month ago 37

“Test Base Class Injection” is a technique that uses C++’s name resolution rules to replace a dependency at compile-time with your own test double/fake/mock.

https://github.com/MiddleRaster/tbci

It works on data-members, arguments, return types, C calls, etc. One use case is mocking a type that is an automatic variable in a static method or constructor, where subclass-and-override doesn’t work.

submitted by /u/According_Leopard_80 to r/cpp
[link] [comments]
Read Entire Article