ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One simple way to do this is to use the preprocessor #define private public trick when testing. You could put this in the cmakelists or a header file that is inlcuded in the class only when testing. This forces all of the methods of the class to be public.

One simple way to do this is to use the preprocessor #define private public trick when testing. In your case you would use #define static. You could put this in the cmakelists or a header file that is inlcuded included in the class c file only when testing. This forces all of the methods of the class file to be public.non static.

One simple way A setup similar to do this is to use the preprocessor following may work for you.

test.h

#define private publicSTATIC_FN
 trick when testing. In your case you would use #define static. You could put this in the cmakelists or a header file that is included in the c file only when testing. This forces all of the methods of the file to be non static.

my_header.h

#ifdef TESTING
#  include "test.h"
#else
#  define STATIC_FN static
#endif
STATIC_FN int doSomething();

my_source.c

STATIC_FN int doSomething() {
   // some code
   return something;
}