test matching

pull/32148/head
Shane Smiskol 1 year ago
parent 3b92eea95c
commit b4b7dcd0db
  1. 16
      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()

Loading…
Cancel
Save