Stub system function in google test
问题 I am trying to use Google Test to test C code but I am encounter some problem related to write stub for system functions like: fopen,fclose,fread,fwrite, memcpy,memset,stat,...I don't known how to stub them correctly to cover all branchs in function that need to be tested. Example , I have a function, how to test it by stub fopen, fclose, fwrite, fread? Only Stub, not Mock. #include <stdio.h> #include <stdlib.h> int main(){ FILE *f; //initialize the arr1 with values int arr1[5]={1,2,3,4,5};