cn-uofbasel / ccn-lite

CCN-lite, a lightweight implementation of the CCNx protocol and its variations
ISC License
74 stars 63 forks source link

[discussion] use flags/defines and unit tests #315

Open mfrey opened 5 years ago

mfrey commented 5 years ago

Description

I've started to add unit tests for ccnl-core and noticed that our current CMakeLists.txt in test does not support various defines we use over the project. As a side effect our unit tests can't reach certain parts, e.g.

void our_function_to_test(void)
{
#ifdef SOME_USE_FLAG
.... some code
.... return -1;
#endif 

#ifdef OTHER_USE_FLAG
... awesome other code
... return -2;
#endif 
}

So, we can't simply just turn on all defines/use flags we use over the project, but have to have fine-grained control over which tests are compiled with which use flags. Any thoughts about it and how we achieve this best?

P.S.: If necessary, I can come up with an example in our code base. The above snippet is just for the sake of clarity. P.P.S.: On a side not, I think that this might also increase the complexity of providing gcov/lcov support for ccn-lite. See also #301