conventional test

This commit is contained in:
Shane Smiskol 2023-11-07 15:57:55 -08:00
parent a180af346e
commit 4b265ad4ab
1 changed files with 9 additions and 13 deletions

View File

@ -916,20 +916,16 @@ class PandaCarSafetyTest(PandaSafetyTest):
# each car has an addr that is used to detect relay malfunction
# if that addr is seen on specified bus, triggers the relay malfunction
# protection logic: both tx_hook and fwd_hook are expected to return failure
for relay_malfunction_bus, relay_malfunction_addrs in self.RELAY_MALFUNCTION_ADDRS.items():
for relay_malfunction_addr in relay_malfunction_addrs:
self.assertFalse(self.safety.get_relay_malfunction())
self._rx(make_msg(relay_malfunction_bus, relay_malfunction_addr, 8))
self.assertTrue(self.safety.get_relay_malfunction())
for bus in range(3):
for addr in self.SCANNED_ADDRS:
self.assertEqual(-1, self._tx(make_msg(bus, addr, 8)))
self.assertEqual(-1, self.safety.safety_fwd_hook(bus, addr))
self.safety.set_relay_malfunction(False)
self._rx(make_msg(bus, addr, 8))
should_relay_malfunction = addr in self.RELAY_MALFUNCTION_ADDRS.get(bus, ())
self.assertEqual(should_relay_malfunction, self.safety.get_relay_malfunction(), (bus, addr))
# test relay malfunction protection logic
self.safety.set_relay_malfunction(True)
for bus in range(3):
for addr in self.SCANNED_ADDRS:
self.assertEqual(-1, self._tx(make_msg(bus, addr, 8)), (bus, addr))
self.assertEqual(-1, self.safety.safety_fwd_hook(bus, addr), (bus, addr))
def test_prev_gas(self):
self.assertFalse(self.safety.get_gas_pressed_prev())