Skip to content

Commit

Permalink
Subaru: added last engage/disengage regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed Mar 14, 2019
1 parent 37d46e0 commit c6eeaad
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/safety/test_subaru.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@ def _torque_msg(self, torque):
def test_default_controls_not_allowed(self):
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 = 0x240 << 21
to_push[0].RDHR = 1 << 9

self.safety.subaru_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 = 0x240 << 21
to_push[0].RDHR = 0

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

def test_steer_safety_check(self):
for enabled in [0, 1]:
for t in range(-3000, 3000):
Expand Down

0 comments on commit c6eeaad

Please sign in to comment.