6 from pal_statistics_msgs.msg
import Statistic
7 from pal_statistics_msgs.msg
import Statistics
9 SYSTEM_NAME =
'test_system' 19 result = self.
cc.statistics_callback(msg)
20 self.assertEquals(result,
'')
26 msg.header.stamp = rospy.Time()
29 stat.name =
"test_stat" 31 msg.statistics.append(stat)
33 result = self.
cc.statistics_callback(msg)
34 output = result.splitlines()
35 self.assertEquals(len(output), 1)
36 self.assertEquals(output[0],
'test_system.test_stat 1234.000000 0')
42 msg.header.stamp = rospy.Time()
45 for i
in range(num_stats):
48 stat.name =
"test_stat_" + str(i)
49 msg.statistics.append(stat)
51 result = self.
cc.statistics_callback(msg)
52 output = result.splitlines()
53 self.assertEquals(len(output), num_stats)
54 for i
in range(num_stats):
55 parts = output[i].split(
' ')
56 self.assertEquals(parts[0],
'test_system.test_stat_' + str(i))
57 self.assertEquals(float(parts[1]), float(i))
58 self.assertEquals(parts[2],
'0')
60 if __name__ ==
'__main__':
62 rospy.init_node(
'test_node')
63 rosunit.unitrun(
'pal_carbon_collector',
'carbon_collector_test', CarbonCollectorTest)
def test_statistics_2(self)
def test_statistics_3(self)
def test_statistics_1(self)