test_range.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rospy
3 from sensor_msgs.msg import Range
4 
5 import unittest
6 
7 class TestRangePlugin(unittest.TestCase):
8 
9  def test_max_range(self):
10  msg = rospy.wait_for_message('/sonar2', Range)
11  self.assertAlmostEqual(msg.range, msg.max_range)
12 
13  def test_inside_range(self):
14  msg = rospy.wait_for_message('/sonar', Range)
15  self.assertTrue(msg.range < 0.25 and msg.range > 0.22, 'actual value: {0}'.format(msg.range))
16 
17 if __name__ == '__main__':
18  import rostest
19  PKG_NAME = 'gazebo_plugins'
20  TEST_NAME = PKG_NAME + 'range_test'
21  rospy.init_node(TEST_NAME)
22  rostest.rosrun(PKG_NAME, TEST_NAME, TestRangePlugin)
test_range.TestRangePlugin.test_max_range
def test_max_range(self)
Definition: test_range.py:9
test_range.TestRangePlugin
Definition: test_range.py:7
test_range.TestRangePlugin.test_inside_range
def test_inside_range(self)
Definition: test_range.py:13


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55