From 3a647037df2f5164de607e096798f4ea0224c288 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 1 Jun 2023 23:26:25 -0700 Subject: [PATCH] test platform codes --- selfdrive/car/hyundai/tests/test_hyundai.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/selfdrive/car/hyundai/tests/test_hyundai.py b/selfdrive/car/hyundai/tests/test_hyundai.py index e7b48822bf..06ab8949bf 100755 --- a/selfdrive/car/hyundai/tests/test_hyundai.py +++ b/selfdrive/car/hyundai/tests/test_hyundai.py @@ -32,6 +32,24 @@ class TestHyundaiFingerprint(unittest.TestCase): for essential_ecu in essential_ecus: self.assertIn(essential_ecu, ecus) + def test_fuzzy_platform_codes(self): + codes = FW_QUERY_CONFIG.fuzzy_get_platform_codes([b'\xf1\x00DH LKAS 1.1 -150210']) + self.assertEqual(codes, {b"DH"}) + + codes = FW_QUERY_CONFIG.fuzzy_get_platform_codes([b'\xf1\x00AEhe SCC H-CUP 1.01 1.01 96400-G2000 ']) + self.assertEqual(codes, {b"AEhe"}) + + codes = FW_QUERY_CONFIG.fuzzy_get_platform_codes([b'\xf1\x00CV1_ RDR ----- 1.00 1.01 99110-CV000 ']) + self.assertEqual(codes, {b"CV1"}) + + codes = FW_QUERY_CONFIG.fuzzy_get_platform_codes([ + b'\xf1\x00DH LKAS 1.1 -150210', + b'\xf1\x00AEhe SCC H-CUP 1.01 1.01 96400-G2000 ', + b'\xf1\x00CV1_ RDR ----- 1.00 1.01 99110-CV000 ', + ]) + self.assertEqual(codes, {b"DH", b"AEhe", b"CV1"}) + + if __name__ == "__main__": unittest.main()