Skip to content

Commit

Permalink
Hyundai: add platform code fuzzy FW test (commaai#29847)
Browse files Browse the repository at this point in the history
add test to assert no crashing
  • Loading branch information
sshane authored Sep 8, 2023
1 parent b09ec6b commit c61479b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions selfdrive/car/hyundai/tests/test_hyundai.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from hypothesis import settings, given, strategies as st
import unittest

from cereal import car
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit c61479b

Please sign in to comment.