api_tests.cpp
Go to the documentation of this file.
1 
6 #include <string>
7 #include <vector>
8 #include <iterator>
9 
10 #include <rtt/os/startstop.h>
11 
12 #include <ocl/DeploymentComponent.hpp>
13 #include <ocl/TaskBrowser.hpp>
14 #include <ocl/LoggingService.hpp>
15 #include <rtt/Logger.hpp>
19 
20 #include <ros/package.h>
21 
22 #include <boost/assign/std/vector.hpp>
23 using namespace boost::assign;
24 
25 #include <gtest/gtest.h>
26 
27 boost::shared_ptr<OCL::DeploymentComponent> deployer;
28 boost::shared_ptr<RTT::Scripting> scripting_service;
30 
31 TEST(BasicTest, Import)
32 {
33  // Import rtt_ros plugin
34  RTT::ComponentLoader::Instance()->import("rtt_ros", "" );
35 }
36 
37 TEST(BasicTest, PackageFinding)
38 {
39  // Import rtt_ros plugin
40  EXPECT_TRUE(scripting_service->eval("ros.import(\"rtt_rospack_tests\")"));
41 
42  RTT::OperationCaller<std::string(const std::string&)> rpf = global_service->provides("ros")->getOperation("find");
43  std::string roscpp_dir = ros::package::getPath("roscpp");
44  EXPECT_EQ(roscpp_dir,rpf("roscpp"));
45 
46  std::string rtt_rospack_tests_dir = ros::package::getPath("rtt_rospack_tests");
47  EXPECT_EQ(rtt_rospack_tests_dir,rpf("rtt_rospack_tests"));
48 }
49 
50 
51 int main(int argc, char** argv) {
52  testing::InitGoogleTest(&argc, argv);
53 
54  // Initialize Orocos
55  __os_init(argc, argv);
56 
57  deployer = boost::make_shared<OCL::DeploymentComponent>();
58  scripting_service = deployer->getProvider<RTT::Scripting>("scripting");
60 
61  RTT::Logger::log().setStdStream(std::cerr);
64 
65  return RUN_ALL_TESTS();
66 }
TEST(BasicTest, Import)
Definition: api_tests.cpp:31
int __os_init(int argc, char **argv)
static boost::shared_ptr< ComponentLoader > Instance()
boost::shared_ptr< Service > shared_ptr
boost::shared_ptr< OCL::DeploymentComponent > deployer
Definition: api_tests.cpp:27
void mayLogStdOut(bool tf)
int main(int argc, char **argv)
Definition: api_tests.cpp:51
ROSLIB_DECL std::string getPath(const std::string &package_name)
boost::shared_ptr< RTT::Scripting > scripting_service
Definition: api_tests.cpp:28
static Logger & log()
RTT::Service::shared_ptr global_service
Definition: api_tests.cpp:29
void setStdStream(std::ostream &stdos)
static RTT_API Service::shared_ptr Instance()
void setLogLevel(LogLevel ll)


rtt_rospack_tests
Author(s): Jonathan Bohren
autogenerated on Sat Jun 8 2019 18:05:24