ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
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.
2 | No.2 Revision |
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.
3 | No.3 Revision |
One simple way A setup similar to do this is to use the preprocessor following may work for you.
test.h
#define
private publicSTATIC_FNtrick 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;
}