From c61479b1aebcf9b713865d18b3e37947c821cca6 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 8 Sep 2023 15:15:22 -0700 Subject: [PATCH] Hyundai: add platform code fuzzy FW test (#29847) add test to assert no crashing --- selfdrive/car/hyundai/tests/test_hyundai.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/selfdrive/car/hyundai/tests/test_hyundai.py b/selfdrive/car/hyundai/tests/test_hyundai.py index 39a9aaf627d945..11268913aa046d 100755 --- a/selfdrive/car/hyundai/tests/test_hyundai.py +++ b/selfdrive/car/hyundai/tests/test_hyundai.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from hypothesis import settings, given, strategies as st import unittest from cereal import car @@ -66,6 +67,14 @@ def test_blacklisted_parts(self): part = code.split(b"-")[1] self.assertFalse(part.startswith(b'CW'), "Car has bad part number") + @settings(max_examples=100) + @given(data=st.data()) + def test_platform_codes_fuzzy_fw(self, data): + """Ensure function doesn't raise an exception""" + fw_strategy = st.lists(st.binary()) + fws = data.draw(fw_strategy) + get_platform_codes(fws) + # Tests for platform codes, part numbers, and FW dates which Hyundai will use to fuzzy # fingerprint in the absence of full FW matches: def test_platform_code_ecus_available(self):