I am doing unit testing using gtest and gmock frameworks and I need help in stubbing/mocking a external C functions used inside class functions
问题 So I am trying to write test cases for my production code but the coverage is drastically low due to the usage of some external C library which cannot be executed without target hardware, So I have no choice but to stub the same. Now the problem is how to stub a C function ? My production code : prod_code.cpp int TargetTestClass::targetFunc() { if(externalCFunc() == True) { statement1; statement2; statement3; /// and so on } } My testcode.cpp generally contains tests like this //Fixture for