|
| 1 | +import unittest |
| 2 | +from osivalidator.osi_general_validator import detect_message_type |
| 3 | + |
| 4 | + |
| 5 | +class TestDetectMessageType(unittest.TestCase): |
| 6 | + def test_detect_message_type_sensor_data(self): |
| 7 | + path = "path/to/file_sd_123.osi" |
| 8 | + message_type = detect_message_type(path) |
| 9 | + self.assertEqual(message_type, "SensorData") |
| 10 | + |
| 11 | + def test_detect_message_type_sensor_view(self): |
| 12 | + path = "path/to/file_sv_123.osi" |
| 13 | + message_type = detect_message_type(path) |
| 14 | + self.assertEqual(message_type, "SensorView") |
| 15 | + |
| 16 | + def test_detect_message_type_sensor_view_config(self): |
| 17 | + path = "path/to/file_svc_123.osi" |
| 18 | + message_type = detect_message_type(path) |
| 19 | + self.assertEqual(message_type, "SensorViewConfiguration") |
| 20 | + |
| 21 | + def test_detect_message_type_ground_truth(self): |
| 22 | + path = "path/to/file_gt_123.osi" |
| 23 | + message_type = detect_message_type(path) |
| 24 | + self.assertEqual(message_type, "GroundTruth") |
| 25 | + |
| 26 | + def test_detect_message_type_traffic_update(self): |
| 27 | + path = "path/to/file_tu_123.osi" |
| 28 | + message_type = detect_message_type(path) |
| 29 | + self.assertEqual(message_type, "TrafficUpdate") |
| 30 | + |
| 31 | + def test_detect_message_type_traffic_command_update(self): |
| 32 | + path = "path/to/file_tcu_123.osi" |
| 33 | + message_type = detect_message_type(path) |
| 34 | + self.assertEqual(message_type, "TrafficCommandUpdate") |
| 35 | + |
| 36 | + def test_detect_message_type_traffic_command(self): |
| 37 | + path = "path/to/file_tc_123.osi" |
| 38 | + message_type = detect_message_type(path) |
| 39 | + self.assertEqual(message_type, "TrafficCommand") |
| 40 | + |
| 41 | + def test_detect_message_type_host_vehicle_data(self): |
| 42 | + path = "path/to/file_hvd_123.osi" |
| 43 | + message_type = detect_message_type(path) |
| 44 | + self.assertEqual(message_type, "HostVehicleData") |
| 45 | + |
| 46 | + def test_detect_message_type_motion_request(self): |
| 47 | + path = "path/to/file_mr_123.osi" |
| 48 | + message_type = detect_message_type(path) |
| 49 | + self.assertEqual(message_type, "MotionRequest") |
| 50 | + |
| 51 | + def test_detect_message_type_streaming_update(self): |
| 52 | + path = "path/to/file_su_123.osi" |
| 53 | + message_type = detect_message_type(path) |
| 54 | + self.assertEqual(message_type, "StreamingUpdate") |
| 55 | + |
| 56 | + def test_detect_message_type_unknown(self): |
| 57 | + path = "path/to/unknown_file.osi" |
| 58 | + message_type = detect_message_type(path) |
| 59 | + self.assertEqual(message_type, "SensorView") |
| 60 | + |
| 61 | + def test_detect_message_type_empty_path(self): |
| 62 | + path = "" |
| 63 | + message_type = detect_message_type(path) |
| 64 | + self.assertEqual(message_type, "SensorView") |
| 65 | + |
| 66 | + |
| 67 | +if __name__ == "__main__": |
| 68 | + unittest.main() |
0 commit comments