Skip to content

Commit

Permalink
Hyundai safety: added tests for cruise enable/disable too
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed Aug 30, 2018
1 parent a91d7ef commit 5398abf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/safety/test_hyundai.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ def test_manually_enable_controls_allowed(self):
self.safety.set_controls_allowed(0)
self.assertFalse(self.safety.get_controls_allowed())

def test_enable_control_allowed_from_cruise(self):
to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_push[0].RIR = 1057 << 21
to_push[0].RDLR = 1 << 13

self.safety.hyundai_rx_hook(to_push)
self.assertTrue(self.safety.get_controls_allowed())

def test_disable_control_allowed_from_cruise(self):
to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_push[0].RIR = 1057 << 21
to_push[0].RDLR = 0

self.safety.set_controls_allowed(1)
self.safety.hyundai_rx_hook(to_push)
self.assertFalse(self.safety.get_controls_allowed())

def test_non_realtime_limit_up(self):
self.safety.set_hyundai_torque_driver(0, 0)
self.safety.set_controls_allowed(True)
Expand Down

0 comments on commit 5398abf

Please sign in to comment.