Hi team,
Just wondering how other people unit test their static function in C? What I am doing now is either test the function first before I change them into static function. Or test the higher level functions that call the static functions only. (not testing the static function directly).
Here is how I usually structure my files.
Just wondering how other people unit test their static function in C? What I am doing now is either test the function first before I change them into static function. Or test the higher level functions that call the static functions only. (not testing the static function directly).
Here is how I usually structure my files.
C:
/* file.h */
int publicFunction(int, int);
/* file.c */
static int privateFunction(int, int);
static int privateFunction(int data_1, int data_2)
{
return data_1 * data_2;
}
int publicFunction(int data_1, int data_2)
{
/* do stuff */
return data_1 + data_2 + privateFunction(data_1, data_2);
}