Unity - Testing static inline functions

110 views
Skip to first unread message

Adam s

unread,
Nov 18, 2021, 11:29:09 AM11/18/21
to ThrowTheSwitch Forums
Do we have certain method to test static inline functions (defined in H file), WA (such wrapping it with macros and redefined them for the test only in c file ?

Example:
foo.h
------------------------------------------------------------------------------------------
static inline void hllo_unity(void) {
            //do stuff
}
---------------------------------------------------------------------------------------------
I don't have foo.c since all my functions are inlined in the foo.h.

When i generate Testfoo_blabla.c which have tests function to test these inline functions and i try to compile with the standard unity make file (downloaded from uniy website), 
I get: "no rule to make the text file"
When i omit the static inline and define these functions in foo.c , every thing work as expected!


Any suggestions ?

Adam s

unread,
Nov 18, 2021, 11:35:04 AM11/18/21
to ThrowTheSwitch Forums
I didn't compelete the sentence after WA, what i'm trying to say, that WA (like wrapping the function like below, is ugly, bad and time consuming, so i am trying to see if you have better solution)
#ifdef UNITTEST
      #define STATIC INLINE
#else
      #define STATIC INLINE static inline
#endif
 
then  in foo.c 

#ifdef UNITTEST
 void hllo_unity(void) {
            //do stuff
}
#endif
Reply all
Reply to author
Forward
0 new messages