You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to mock a c library function, i.e. int abs(int a). I writen my testcase like this, but when I execute it, the testcase call the real one, not the mocked one. I want to know how to mock a c library function, especially the variadic function, i.e. open and ioctl.
source file:src.cpp #include <stdlib.h> int abs_test() { return abs(-1); }
include file:src.h int abs_test();
test file:test.cpp
The second one can pass, but the first one fail.
And I also want to know whether a parameter can be set to an arbitrary value rather than a fixed value when I mock a function?
The text was updated successfully, but these errors were encountered:
FrankLiang826
changed the title
Hello my friends, I wonder how to mock a c library function by using cpputest. Thanks very much.
Hello my friends, I wonder how to mock a c library function by using cpputest. Thanks very much.
Dec 19, 2023
I want to mock a c library function, i.e. int abs(int a). I writen my testcase like this, but when I execute it, the testcase call the real one, not the mocked one. I want to know how to mock a c library function, especially the variadic function, i.e. open and ioctl.
source file:src.cpp
#include <stdlib.h> int abs_test() { return abs(-1); }
include file:src.h
int abs_test();
test file:test.cpp
The second one can pass, but the first one fail.
And I also want to know whether a parameter can be set to an arbitrary value rather than a fixed value when I mock a function?
The text was updated successfully, but these errors were encountered: