title: Check Unit testing in C: Best way to test static methods
body: <p>I am using Check framework do to unit testing of my C code, and I couldn't find a proper way to test the static methods. </p>
  
  <p>My work around, is not ideal at all and would like if someone can point me in the right direction on how to do it properly. My work around is simply by add #ifdef macro that changes the static methods to extern in case I pass -D DEBUG at compile time.</p>
  
  <p>In the source file </p>
  
  <pre><code>#ifdef DEBUG
  unsigned ds_roundup_to_prime (const unsigned bsize) {
  #else
  static inline unsigned ds_roundup_to_prime (const unsigned bsize) {
  #endif
  </code></pre>
  
  <p>And in the header file I do </p>
  
  <pre><code>#ifdef DEBUG
  unsigned ds_roundup_to_prime (const unsigned bsize);
  #endif
  </code></pre>
  
  <p>Ideally source code shouldn't change to cater for unit tests. Unit-test framework, should must be capable of testing the source code as it will look in production. </p>
  
  <p>Thanks</p>