mirror of
https://github.com/infiniteCable2/opendbc.git
synced 2026-06-08 10:54:51 +08:00
26 lines
911 B
Python
26 lines
911 B
Python
import unittest
|
|
|
|
from opendbc.car.rivian.fingerprints import FW_VERSIONS
|
|
from opendbc.car.rivian.values import CAR, FW_QUERY_CONFIG, WMI, ModelLine, ModelYear
|
|
|
|
|
|
class TestRivian(unittest.TestCase):
|
|
def test_custom_fuzzy_fingerprinting(self):
|
|
for platform in CAR:
|
|
with self.subTest(platform=platform.name):
|
|
for wmi in WMI:
|
|
for line in ModelLine:
|
|
for year in ModelYear:
|
|
for bad in (True, False):
|
|
vin = ["0"] * 17
|
|
vin[:3] = wmi
|
|
vin[3] = line.value
|
|
vin[9] = year.value
|
|
if bad:
|
|
vin[3] = "Z"
|
|
vin = "".join(vin)
|
|
|
|
matches = FW_QUERY_CONFIG.match_fw_to_car_fuzzy({}, vin, FW_VERSIONS)
|
|
should_match = year in platform.config.years and not bad
|
|
assert (matches == {platform}) == should_match, "Bad match"
|