Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbruno25 committed Dec 26, 2023
1 parent f0634d2 commit dbf7332
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/back2back_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@ def test_sub_second_timestamp_resolution(self):
self.bus2.recv(0)
self.bus2.recv(0)

def test_perodic_tasks_do_not_exceed_duration(self):
duration, period = 2.0, 0.6
messages = []

self.bus2.send_periodic(can.Message(), period, duration)
while True:
msg = self.bus1.recv(period + 0.1)
if msg is None:
break
messages.append(msg)

delta_t = messages[-1].timestamp - messages[0].timestamp
assert delta_t <= duration


@unittest.skipUnless(TEST_INTERFACE_SOCKETCAN, "skip testing of socketcan")
class BasicTestSocketCan(Back2BackTestCase):
Expand Down

0 comments on commit dbf7332

Please sign in to comment.