def test_make_list_of_waypoints(self): logs = pl.filename_to_list_of_strings('example_short_log.txt') waypoints_only = pl.filter_by_2nd_item(logs, 'TRACE_WAYPOINTS') waypoints = pl.make_list_of_waypoints(waypoints_only) for each_dict in waypoints: keys_list = list(each_dict.keys()) keys_list.sort() self.assertEqual(keys_list, ['waypoint', 'x', 'y'])
def __init__(self, filename): big_float = 100000.0 # These max and min are across all waypoints and car positions. self.min_x = big_float # Easy for minimum to be less than this. self.max_x = -big_float # Easy for maximum to be more than this. self.min_y = big_float self.max_y = -big_float logs = pl.filename_to_list_of_strings(filename) waypoints_only = pl.filter_by_2nd_item(logs, 'TRACE_WAYPOINTS') statuses_only = pl.filter_by_2nd_item(logs, 'TRACE_STATUS') self.waypoints = pl.make_list_of_waypoints(waypoints_only) self.statuses = pl.make_list_of_statuses(statuses_only) self.start_time = (self.statuses[0])['timestamp']
def test_make_list_of_statuses(self): logs = pl.filename_to_list_of_strings('example_short_log.txt') statuses_only = pl.filter_by_2nd_item(logs, 'TRACE_STATUS') los = pl.make_list_of_statuses(statuses_only) self.assertEqual(len(los), 4)
def test_filter_by_2nd_item(self): logs = pl.filename_to_list_of_strings('example_short_log.txt') filtered_logs = pl.filter_by_2nd_item(logs, 'TRACE_WAYPOINTS') for log_entry in filtered_logs: self.assertEqual(log_entry[1], 'TRACE_WAYPOINTS')
def test2(): logs = pl.filename_to_list_of_strings('simulation_log.txt') print(pl.filter_by_2nd_item(logs, 'TRACE_WAYPOINTS'))
def test4(): logs = pl.filename_to_list_of_strings('simulation_log.txt') statuses_only = pl.filter_by_2nd_item(logs, 'TRACE_STATUS') los = pl.make_list_of_statuses(statuses_only) print(len(los))
def test3(): logs = pl.filename_to_list_of_strings('simulation_log.txt') waypoints_only = pl.filter_by_2nd_item(logs, 'TRACE_WAYPOINTS') print(pl.make_list_of_waypoints(waypoints_only))