Thought I'd put this out there as I didn't find anything within the forums on this, and it took me a little while to figure out.
The following is one method to run Orocos-related unit tests within CxxTest (in case you're not using CppUnit like Orocos does). It basically wraps up the pre/post-main() functionality hidden by ORO_main(). Just add the following code to your test file either inline or through a header file. I have not yet tried compiling this to an object file and linking it in. Not sure if this will work due to Cxxtest's habit of preprocessing and looking for "interesting" things.
Without this code, things did run but I got some odd errors popping out of Orocos - go figure!
HTH
Stephen
{{{
// startup and shutdown Orocos correctly
class OrocosCxxTestWorld : public CxxTest::GlobalFixture
{
public:
// run before all test suites
virtual bool setUpWorld()
{
/// \todo Get argc/argv through CxxTest ... this it not trivial!
char* name = "
char* argv[] = {name};
int argc = 1;
return (0 ==__os_init(argc, argv)); // pre-main startup
}
// run after all test suites
virtual bool tearDownWorld()
{
__os_exit(); // post-main shutdown
return true;
}
};
static OrocosCxxTestWorld w;
}}}