From b4b7dcd0db72ecc5305a1fd548d0df11b80d4acb Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 9 Apr 2024 22:19:17 -0700 Subject: [PATCH] test matching --- .../car/volkswagen/tests/test_volkswagen.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/volkswagen/tests/test_volkswagen.py b/selfdrive/car/volkswagen/tests/test_volkswagen.py index a82fb31cc5..f1d3015479 100755 --- a/selfdrive/car/volkswagen/tests/test_volkswagen.py +++ b/selfdrive/car/volkswagen/tests/test_volkswagen.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import unittest -from openpilot.selfdrive.car.volkswagen.values import CAR +from openpilot.selfdrive.car.volkswagen.values import CAR, FW_QUERY_CONFIG class TestVolkswagenPlatformConfigs(unittest.TestCase): @@ -17,6 +17,20 @@ class TestVolkswagenPlatformConfigs(unittest.TestCase): self.assertEqual(set(), platform.config.chassis_codes & comp.config.chassis_codes, f"Shared chassis codes: {comp}") + def test_custom_fingerprinting(self): + matches = FW_QUERY_CONFIG.match_fw_to_car_custom(None, '0' * 17, None) + self.assertEqual(set(), matches, "Bad match") + + for platform in CAR: + with self.subTest(platform=platform): + for chassis_code in platform.config.chassis_codes: + vin = ['0'] * 17 + vin[6:8] = chassis_code + vin = ''.join(vin) + + matches = FW_QUERY_CONFIG.match_fw_to_car_custom(None, vin, None) + self.assertEqual({platform}, matches, "Bad match") + if __name__ == "__main__": unittest.main()