41 #include <gtest/gtest.h> 47 #include "test_roscpp/TestEmpty.h" 49 TEST(masterInfo, getPublishedTopics)
53 typedef std::set<std::string>
S_string;
54 S_string advertised_topics;
55 advertised_topics.insert(
"/test_topic_1" );
56 advertised_topics.insert(
"/test_topic_2" );
57 advertised_topics.insert(
"/test_topic_3" );
58 advertised_topics.insert(
"/test_topic_4" );
59 advertised_topics.insert(
"/test_topic_5" );
60 advertised_topics.insert(
"/test_topic_6" );
61 advertised_topics.insert(
"/test_topic_7" );
62 advertised_topics.insert(
"/test_topic_8" );
64 std::vector<ros::Publisher> pubs;
66 S_string::iterator adv_it = advertised_topics.begin();
67 S_string::iterator adv_end = advertised_topics.end();
68 for ( ; adv_it != adv_end; ++adv_it )
70 const std::string& topic = *adv_it;
71 pubs.push_back(nh.
advertise<test_roscpp::TestEmpty>( topic, 0 ));
77 adv_it = advertised_topics.begin();
78 adv_end = advertised_topics.end();
79 for ( ; adv_it != adv_end; ++adv_it )
81 const std::string& topic = *adv_it;
84 ros::master::V_TopicInfo::iterator master_it = master_topics.begin();
85 ros::master::V_TopicInfo::iterator master_end = master_topics.end();
86 for ( ; master_it != master_end; ++master_it )
89 if ( topic == info.
name )
104 testing::InitGoogleTest(&argc, argv);
105 ros::init( argc, argv,
"get_master_information" );
108 return RUN_ALL_TESTS();
std::set< std::string > S_string
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL bool getTopics(V_TopicInfo &topics)
std::vector< TopicInfo > V_TopicInfo
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)