Skip to content

Commit

Permalink
test the error case as well
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Oct 16, 2023
1 parent ec09ddb commit 119e643
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/cfdp/pdus/test_file_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ def test_max_file_seg_calculator_2(self):
fd_pdu = FileDataPdu(pdu_conf, FileDataParams(bytes(), 0))
self.assertEqual(fd_pdu.get_max_file_seg_len_for_max_packet_len(64), 49)

def test_max_file_seg_calculator_error(self):
pdu_conf = PduConfig.default()
file_seg_len = get_max_file_seg_len_for_max_packet_len_and_pdu_cfg(pdu_conf, 11)
self.assertEqual(file_seg_len, 0)
with self.assertRaises(ValueError):
file_seg_len = get_max_file_seg_len_for_max_packet_len_and_pdu_cfg(pdu_conf, 10)
fd_pdu = FileDataPdu(pdu_conf, FileDataParams(bytes(), 0))
with self.assertRaises(ValueError):
fd_pdu.get_max_file_seg_len_for_max_packet_len(10)

def test_state(self):
self.assertEqual(self.pdu.pdu_header.header_len, 7)
# 15: 'hello world' encoded + 4 bytes offset
Expand Down

0 comments on commit 119e643

Please sign in to comment.