Skip to content

Commit

Permalink
Add test for osi3trace offset reading robustness
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre R. Mai <pmai@pmsf.de>
  • Loading branch information
pmai committed Apr 5, 2024
1 parent c6735c6 commit d5f44e4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_osi_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ def test_osi_trace(self):

self.assertTrue(os.path.exists(path_output))

def test_osi_trace_offsets_robustness(self):
with tempfile.TemporaryDirectory() as tmpdirname:
path_input = os.path.join(tmpdirname, "input.osi")
create_sample(path_input)

trace = OSITrace(path_input)
# Test whether the function can handle be run multiple times safely
offsets = trace.retrieve_offsets(None)
offsets2 = trace.retrieve_offsets(None)
trace.close()

self.assertEqual(len(offsets), 10)
self.assertEqual(offsets, offsets2)

def create_sample(path):
f = open(path, "ab")
Expand Down

0 comments on commit d5f44e4

Please sign in to comment.