00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 import roslib; roslib.load_manifest('test_roslib')
00033
00034 import os
00035 import sys
00036 import unittest
00037
00038 import roslib.names
00039 import rosunit
00040
00041 class ParamsTest(unittest.TestCase):
00042
00043 def test_load_param_mappings(self):
00044 from roslib.params import load_command_line_node_params
00045 self.assertEquals({}, load_command_line_node_params([]))
00046 self.assertEquals({}, load_command_line_node_params(['foo']))
00047 self.assertEquals({}, load_command_line_node_params(['_foo']))
00048 self.assertEquals({}, load_command_line_node_params([':=']))
00049 self.assertEquals({}, load_command_line_node_params([':=:=']))
00050 self.assertEquals({}, load_command_line_node_params(['_f:=']))
00051 self.assertEquals({}, load_command_line_node_params([':=b']))
00052 self.assertEquals({}, load_command_line_node_params(['_foo:=_bar:=baz']))
00053
00054 self.assertEquals({'foo': 'bar'}, load_command_line_node_params(['_foo:=bar']))
00055 self.assertEquals({'foo': 'bar'}, load_command_line_node_params(['./f', '-x', '--blah', '_foo:=bar']))
00056 self.assertEquals({'a': 'one', 'b': 2, 'c': 3.0, 'd':[1,2,3,4]}, load_command_line_node_params(['_c:=3.0', '_c:=', ':=3', '_a:=one', '_b:=2', '_d:=[1,2,3,4]']))
00057
00058
00059 if __name__ == '__main__':
00060 rosunit.unitrun('test_roslib', 'test_params', ParamsTest, coverage_packages=['roslib.params'])
00061