checkpoint_marker_test.cpp
Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 #include <ros/ros.h>
00004 #include <gtest/gtest.h>
00005 #include "rviz_marker_stub.cpp"
00006 
00007 #include "../../src/checkpoint_marker.h"
00008 
00009 TEST(RvizMarkerStub, basic)
00010 {
00011     RvizMarkerStub rviz_stub;
00012 
00013     ASSERT_EQ(rviz_stub.count_markers_received(), 0);
00014 }
00015 
00016 TEST(CheckpointMarker, check_conection)
00017 {
00018     CheckpointMarker marker_server;
00019     RvizMarkerStub rviz_stub;
00020     CheckpointRequest position;
00021 
00022     /* sleep one sec help to connect to rviz if it is being used. 
00023      * Otherwise it won't display the checkpoints */
00024     sleep(1);
00025 
00026     marker_server.display_new_checkpoint(position);
00027     usleep(200); // some time is needed to transmit the msg through topic
00028 
00029     ASSERT_EQ(rviz_stub.count_markers_received(),1);
00030 
00031     marker_server.display_active_checkpoint(position);
00032     usleep(200);
00033 
00034     ASSERT_EQ(rviz_stub.count_markers_received(),2);
00035 
00036     marker_server.display_visited_checkpoint(position);
00037     usleep(200);
00038 
00039     ASSERT_EQ(rviz_stub.count_markers_received(),3);
00040 }
00041 
00042 // Run all the tests that were declared with TEST()
00043 int main(int argc, char **argv)
00044 {
00045     ros::init(argc, argv, "checkpoint_marker_test");
00046 
00047     // create asynchronous thread for handling service requests
00048     ros::AsyncSpinner spinner(1);
00049     spinner.start();
00050 
00051     testing::InitGoogleTest(&argc, argv);
00052     return RUN_ALL_TESTS();
00053 }


iri_checkpoint_nav
Author(s): Jose Luis Rivero
autogenerated on Fri Dec 6 2013 22:56:28