Skip to content

Commit

Permalink
assert expected openpilot undefined message behavior (#1050)
Browse files Browse the repository at this point in the history
assert expected openpilot behavior
  • Loading branch information
sshane authored and deanlee committed Jun 6, 2024
1 parent b0ca681 commit c231d9c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions can/tests/test_packer_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,18 @@ def test_disallow_duplicate_messages(self):
with self.assertRaises(RuntimeError):
CANParser("toyota_nodsu_pt_generated", [("ACC_CONTROL", 10), ("ACC_CONTROL", 10)])

def test_allow_undefined_msgs(self):
# TODO: we should throw an exception for these, but we need good
# discovery tests in openpilot first
packer = CANPacker("toyota_nodsu_pt_generated")

self.assertEqual(packer.make_can_msg("ACC_CONTROL", 0, {"UNKNOWN_SIGNAL": 0}),
[835, 0, b'\x00\x00\x00\x00\x00\x00\x00N', 0])
self.assertEqual(packer.make_can_msg("UNKNOWN_MESSAGE", 0, {"UNKNOWN_SIGNAL": 0}),
[0, 0, b'', 0])
self.assertEqual(packer.make_can_msg(0, 0, {"UNKNOWN_SIGNAL": 0}),
[0, 0, b'', 0])


if __name__ == "__main__":
unittest.main()

0 comments on commit c231d9c

Please sign in to comment.